Skip to content

Commit 44b7144

Browse files
committed
add ERRORs notation in doc_unsafe.rs
Well, I mistakenly thinking it was the test file for [`undocumented_unsafe_blocks`] at first... but it doesn't make things worse anyway, so I keep them lol.
1 parent 6d9516a commit 44b7144

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

tests/ui/doc_unsafe.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use proc_macros::external;
77

88
/// This is not sufficiently documented
99
pub unsafe fn destroy_the_planet() {
10+
//~^ ERROR: unsafe function's docs miss `# Safety` section
1011
unimplemented!();
1112
}
1213

@@ -30,6 +31,7 @@ mod private_mod {
3031
}
3132

3233
pub unsafe fn republished() {
34+
//~^ ERROR: unsafe function's docs miss `# Safety` section
3335
unimplemented!();
3436
}
3537
}
@@ -38,12 +40,14 @@ pub use private_mod::republished;
3840

3941
pub trait SafeTraitUnsafeMethods {
4042
unsafe fn woefully_underdocumented(self);
43+
//~^ ERROR: unsafe function's docs miss `# Safety` section
4144

4245
/// # Safety
4346
unsafe fn at_least_somewhat_documented(self);
4447
}
4548

4649
pub unsafe trait UnsafeTrait {
50+
//~^ ERROR: docs for unsafe trait missing `# Safety` section
4751
fn method();
4852
}
4953

@@ -74,6 +78,7 @@ unsafe impl DocumentedUnsafeTrait for Struct {
7478

7579
impl Struct {
7680
pub unsafe fn more_undocumented_unsafe() -> Self {
81+
//~^ ERROR: unsafe function's docs miss `# Safety` section
7782
unimplemented!();
7883
}
7984

@@ -103,6 +108,7 @@ macro_rules! very_unsafe {
103108
}
104109

105110
very_unsafe!();
111+
//~^ ERROR: unsafe function's docs miss `# Safety` section
106112

107113
// we don't lint code from external macros
108114
external! {

tests/ui/doc_unsafe.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ LL | pub unsafe fn destroy_the_planet() {
88
= help: to override `-D warnings` add `#[allow(clippy::missing_safety_doc)]`
99

1010
error: unsafe function's docs miss `# Safety` section
11-
--> $DIR/doc_unsafe.rs:32:5
11+
--> $DIR/doc_unsafe.rs:33:5
1212
|
1313
LL | pub unsafe fn republished() {
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515

1616
error: unsafe function's docs miss `# Safety` section
17-
--> $DIR/doc_unsafe.rs:40:5
17+
--> $DIR/doc_unsafe.rs:42:5
1818
|
1919
LL | unsafe fn woefully_underdocumented(self);
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2121

2222
error: docs for unsafe trait missing `# Safety` section
23-
--> $DIR/doc_unsafe.rs:46:1
23+
--> $DIR/doc_unsafe.rs:49:1
2424
|
2525
LL | pub unsafe trait UnsafeTrait {
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2727

2828
error: unsafe function's docs miss `# Safety` section
29-
--> $DIR/doc_unsafe.rs:76:5
29+
--> $DIR/doc_unsafe.rs:80:5
3030
|
3131
LL | pub unsafe fn more_undocumented_unsafe() -> Self {
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333

3434
error: unsafe function's docs miss `# Safety` section
35-
--> $DIR/doc_unsafe.rs:92:9
35+
--> $DIR/doc_unsafe.rs:97:9
3636
|
3737
LL | pub unsafe fn whee() {
3838
| ^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)