This repository was archived by the owner on May 28, 2025. It is now read-only.
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 @@ -1998,7 +1998,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
19981998 // catch `repr()` with no arguments, applied to an item (i.e. not `#![repr()]`)
19991999 if item. is_some ( ) {
20002000 match target {
2001- Target :: Struct | Target :: Union | Target :: Enum => { }
2001+ Target :: Struct | Target :: Union | Target :: Enum => continue ,
20022002 Target :: Fn | Target :: Method ( _) => {
20032003 feature_err (
20042004 & 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