File tree 3 files changed +37
-1
lines changed
compiler/rustc_passes/src
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -1998,7 +1998,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1998
1998
// catch `repr()` with no arguments, applied to an item (i.e. not `#![repr()]`)
1999
1999
if item. is_some ( ) {
2000
2000
match target {
2001
- Target :: Struct | Target :: Union | Target :: Enum => { }
2001
+ Target :: Struct | Target :: Union | Target :: Enum => continue ,
2002
2002
Target :: Fn | Target :: Method ( _) => {
2003
2003
feature_err (
2004
2004
& self . tcx . sess ,
Original file line number Diff line number Diff line change
1
+ //@ compile-flags: --crate-type=lib
2
+ #![ deny( unused_attributes) ]
3
+
4
+ #[ repr( ) ] //~ ERROR unused attribute
5
+ #[ repr( packed) ] //~ ERROR attribute should be applied to a struct or union
6
+ pub enum Foo {
7
+ Bar ,
8
+ Baz ( i32 ) ,
9
+ }
Original file line number Diff line number Diff line change
1
+ error: unused attribute
2
+ --> $DIR/repr-empty-packed.rs:4:1
3
+ |
4
+ LL | #[repr()]
5
+ | ^^^^^^^^^ help: remove this attribute
6
+ |
7
+ = note: attribute `repr` with an empty list has no effect
8
+ note: the lint level is defined here
9
+ --> $DIR/repr-empty-packed.rs:2:9
10
+ |
11
+ LL | #![deny(unused_attributes)]
12
+ | ^^^^^^^^^^^^^^^^^
13
+
14
+ error[E0517]: attribute should be applied to a struct or union
15
+ --> $DIR/repr-empty-packed.rs:5:8
16
+ |
17
+ LL | #[repr(packed)]
18
+ | ^^^^^^
19
+ LL | / pub enum Foo {
20
+ LL | | Bar,
21
+ LL | | Baz(i32),
22
+ LL | | }
23
+ | |_- not a struct or union
24
+
25
+ error: aborting due to 2 previous errors
26
+
27
+ For more information about this error, try `rustc --explain E0517`.
You can’t perform that action at this time.
0 commit comments