File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -605,6 +605,16 @@ impl CheckAttrVisitor<'tcx> {
605
605
return false ;
606
606
}
607
607
}
608
+ } else {
609
+ self . tcx . struct_span_lint_hir (
610
+ INVALID_DOC_ATTRIBUTES ,
611
+ hir_id,
612
+ meta. span ( ) ,
613
+ |lint| {
614
+ lint. build ( & format ! ( "unknown `doc` attribute" ) ) . emit ( ) ;
615
+ } ,
616
+ ) ;
617
+ return false ;
608
618
}
609
619
}
610
620
}
Original file line number Diff line number Diff line change 8
8
//~^ ERROR unknown `doc` attribute
9
9
//~^^ WARN
10
10
pub fn foo ( ) { }
11
+
12
+ #[ doc( 123 ) ]
13
+ //~^ ERROR unknown `doc` attribute
14
+ //~| WARN
15
+ #[ doc( "hello" , "bar" ) ]
16
+ //~^ ERROR unknown `doc` attribute
17
+ //~| WARN
18
+ fn bar ( ) { }
Original file line number Diff line number Diff line change @@ -13,6 +13,24 @@ LL | #![deny(warnings)]
13
13
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14
14
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
15
15
16
+ error: unknown `doc` attribute
17
+ --> $DIR/doc-attr.rs:12:7
18
+ |
19
+ LL | #[doc(123)]
20
+ | ^^^
21
+ |
22
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
24
+
25
+ error: unknown `doc` attribute
26
+ --> $DIR/doc-attr.rs:15:7
27
+ |
28
+ LL | #[doc("hello", "bar")]
29
+ | ^^^^^^^
30
+ |
31
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
32
+ = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
33
+
16
34
error: unknown `doc` attribute `as_ptr`
17
35
--> $DIR/doc-attr.rs:3:8
18
36
|
@@ -22,5 +40,5 @@ LL | #![doc(as_ptr)]
22
40
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23
41
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
24
42
25
- error: aborting due to 2 previous errors
43
+ error: aborting due to 4 previous errors
26
44
You can’t perform that action at this time.
0 commit comments