File tree Expand file tree Collapse file tree 5 files changed +54
-17
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 5 files changed +54
-17
lines changed Original file line number Diff line number Diff line change @@ -567,16 +567,23 @@ impl CheckAttrVisitor<'tcx> {
567567 . iter ( )
568568 . any ( |m| i_meta. has_name ( * m) )
569569 {
570- self . tcx
571- . sess
572- . struct_span_err (
573- meta. span ( ) ,
574- & format ! (
570+ self . tcx . struct_span_lint_hir (
571+ UNUSED_ATTRIBUTES ,
572+ hir_id,
573+ i_meta. span ,
574+ |lint| {
575+ lint. build ( & format ! (
575576 "unknown `doc` attribute `{}`" ,
576- i_meta. name_or_empty( ) ,
577- ) ,
578- )
579- . emit ( ) ;
577+ i_meta. name_or_empty( )
578+ ) )
579+ . warn (
580+ "this was previously accepted by the compiler but is \
581+ being phased out; it will become a hard error in \
582+ a future release!",
583+ )
584+ . emit ( ) ;
585+ } ,
586+ ) ;
580587 return false ;
581588 }
582589 }
Original file line number Diff line number Diff line change 11#![ crate_type = "lib" ]
2- #![ doc( as_ptr) ] //~ ERROR
2+ #![ deny( unused_attributes) ]
3+ //~^ NOTE lint level is defined here
4+ #![ doc( as_ptr) ]
5+ //~^ ERROR unknown `doc` attribute
6+ //~| WARNING will become a hard error in a future release
37
4- #[ doc( as_ptr) ] //~ ERROR
8+ #[ doc( as_ptr) ]
9+ //~^ ERROR unknown `doc` attribute
10+ //~| WARNING will become a hard error in a future release
511pub fn foo ( ) { }
Original file line number Diff line number Diff line change 11error: unknown `doc` attribute `as_ptr`
2- --> $DIR/doc-attr.rs:4 :7
2+ --> $DIR/doc-attr.rs:8 :7
33 |
44LL | #[doc(as_ptr)]
55 | ^^^^^^
6+ |
7+ note: the lint level is defined here
8+ --> $DIR/doc-attr.rs:2:9
9+ |
10+ LL | #![deny(unused_attributes)]
11+ | ^^^^^^^^^^^^^^^^^
12+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
613
714error: unknown `doc` attribute `as_ptr`
8- --> $DIR/doc-attr.rs:2 :8
15+ --> $DIR/doc-attr.rs:4 :8
916 |
1017LL | #![doc(as_ptr)]
1118 | ^^^^^^
19+ |
20+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1221
1322error: aborting due to 2 previous errors
1423
Original file line number Diff line number Diff line change 11#![ crate_type = "lib" ]
2- #![ doc( as_ptr) ] //~ ERROR
2+ #![ deny( unused_attributes) ]
3+ //~^ NOTE lint level is defined here
4+ #![ doc( as_ptr) ]
5+ //~^ ERROR unknown `doc` attribute
6+ //~| WARNING will become a hard error in a future release
37
4- #[ doc( as_ptr) ] //~ ERROR
8+ #[ doc( as_ptr) ]
9+ //~^ ERROR unknown `doc` attribute
10+ //~| WARNING will become a hard error in a future release
511pub fn foo ( ) { }
Original file line number Diff line number Diff line change 11error: unknown `doc` attribute `as_ptr`
2- --> $DIR/doc-attr.rs:4 :7
2+ --> $DIR/doc-attr.rs:8 :7
33 |
44LL | #[doc(as_ptr)]
55 | ^^^^^^
6+ |
7+ note: the lint level is defined here
8+ --> $DIR/doc-attr.rs:2:9
9+ |
10+ LL | #![deny(unused_attributes)]
11+ | ^^^^^^^^^^^^^^^^^
12+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
613
714error: unknown `doc` attribute `as_ptr`
8- --> $DIR/doc-attr.rs:2 :8
15+ --> $DIR/doc-attr.rs:4 :8
916 |
1017LL | #![doc(as_ptr)]
1118 | ^^^^^^
19+ |
20+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1221
1322error: aborting due to 2 previous errors
1423
You can’t perform that action at this time.
0 commit comments