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> {
605605 return false ;
606606 }
607607 }
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 ;
608618 }
609619 }
610620 }
Original file line number Diff line number Diff line change 88//~^ ERROR unknown `doc` attribute
99//~^^ WARN
1010pub 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)]
1313 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1414 = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
1515
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+
1634error: unknown `doc` attribute `as_ptr`
1735 --> $DIR/doc-attr.rs:3:8
1836 |
@@ -22,5 +40,5 @@ LL | #![doc(as_ptr)]
2240 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2341 = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
2442
25- error: aborting due to 2 previous errors
43+ error: aborting due to 4 previous errors
2644
You can’t perform that action at this time.
0 commit comments