File tree 4 files changed +9
-6
lines changed
compiler/rustc_passes/src
4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -561,12 +561,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
561
561
allowed_target : Target ,
562
562
) {
563
563
if target != allowed_target {
564
+ let path = attr. path ( ) ;
565
+ let path: Vec < _ > = path. iter ( ) . map ( |s| s. as_str ( ) ) . collect ( ) ;
566
+ let attr_name = path. join ( "::" ) ;
564
567
self . tcx . emit_node_span_lint (
565
568
UNUSED_ATTRIBUTES ,
566
569
hir_id,
567
570
attr. span ( ) ,
568
571
errors:: OnlyHasEffectOn {
569
- attr_name : attr . name_or_empty ( ) ,
572
+ attr_name,
570
573
target_name : allowed_target. name ( ) . replace ( ' ' , "_" ) ,
571
574
} ,
572
575
) ;
Original file line number Diff line number Diff line change @@ -1433,7 +1433,7 @@ pub(crate) struct UselessAssignment<'a> {
1433
1433
#[ derive( LintDiagnostic ) ]
1434
1434
#[ diag( passes_only_has_effect_on) ]
1435
1435
pub ( crate ) struct OnlyHasEffectOn {
1436
- pub attr_name : Symbol ,
1436
+ pub attr_name : String ,
1437
1437
pub target_name : String ,
1438
1438
}
1439
1439
Original file line number Diff line number Diff line change 44
44
struct Foo {
45
45
#[ should_panic:: skip]
46
46
//~^ ERROR failed to resolve
47
- //~| ERROR `#[]` only has an effect on functions
47
+ //~| ERROR `#[should_panic::skip ]` only has an effect on functions
48
48
pub field : u8 ,
49
49
50
50
#[ should_panic:: a:: b:: c]
51
51
//~^ ERROR failed to resolve
52
- //~| ERROR `#[]` only has an effect on functions
52
+ //~| ERROR `#[should_panic::a::b::c ]` only has an effect on functions
53
53
pub field2 : u8 ,
54
54
}
55
55
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `den
16
16
LL | #[deny::skip]
17
17
| ^^^^ use of unresolved module or unlinked crate `deny`
18
18
19
- error: `#[]` only has an effect on functions
19
+ error: `#[should_panic::skip ]` only has an effect on functions
20
20
--> $DIR/check-builtin-attr-ice.rs:45:5
21
21
|
22
22
LL | #[should_panic::skip]
@@ -28,7 +28,7 @@ note: the lint level is defined here
28
28
LL | #![deny(unused_attributes)]
29
29
| ^^^^^^^^^^^^^^^^^
30
30
31
- error: `#[]` only has an effect on functions
31
+ error: `#[should_panic::a::b::c ]` only has an effect on functions
32
32
--> $DIR/check-builtin-attr-ice.rs:50:5
33
33
|
34
34
LL | #[should_panic::a::b::c]
You can’t perform that action at this time.
0 commit comments