File tree 5 files changed +54
-17
lines changed
compiler/rustc_passes/src
5 files changed +54
-17
lines changed Original file line number Diff line number Diff line change @@ -567,16 +567,23 @@ impl CheckAttrVisitor<'tcx> {
567
567
. iter ( )
568
568
. any ( |m| i_meta. has_name ( * m) )
569
569
{
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 ! (
575
576
"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
+ ) ;
580
587
return false ;
581
588
}
582
589
}
Original file line number Diff line number Diff line change 1
1
#![ 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
3
7
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
5
11
pub fn foo ( ) { }
Original file line number Diff line number Diff line change 1
1
error: unknown `doc` attribute `as_ptr`
2
- --> $DIR/doc-attr.rs:4 :7
2
+ --> $DIR/doc-attr.rs:8 :7
3
3
|
4
4
LL | #[doc(as_ptr)]
5
5
| ^^^^^^
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!
6
13
7
14
error: unknown `doc` attribute `as_ptr`
8
- --> $DIR/doc-attr.rs:2 :8
15
+ --> $DIR/doc-attr.rs:4 :8
9
16
|
10
17
LL | #![doc(as_ptr)]
11
18
| ^^^^^^
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!
12
21
13
22
error: aborting due to 2 previous errors
14
23
Original file line number Diff line number Diff line change 1
1
#![ 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
3
7
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
5
11
pub fn foo ( ) { }
Original file line number Diff line number Diff line change 1
1
error: unknown `doc` attribute `as_ptr`
2
- --> $DIR/doc-attr.rs:4 :7
2
+ --> $DIR/doc-attr.rs:8 :7
3
3
|
4
4
LL | #[doc(as_ptr)]
5
5
| ^^^^^^
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!
6
13
7
14
error: unknown `doc` attribute `as_ptr`
8
- --> $DIR/doc-attr.rs:2 :8
15
+ --> $DIR/doc-attr.rs:4 :8
9
16
|
10
17
LL | #![doc(as_ptr)]
11
18
| ^^^^^^
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!
12
21
13
22
error: aborting due to 2 previous errors
14
23
You can’t perform that action at this time.
0 commit comments