forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#138253 - mu001999-contrib:fix-138241, r=jdonszelmann Continue to check attr if meet empty repr for adt Fixes rust-lang#138241 Returning while checking ReprEmpty results in missing the check for the next repr
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@ compile-flags: --crate-type=lib | ||
#![deny(unused_attributes)] | ||
|
||
#[repr()] //~ ERROR unused attribute | ||
#[repr(packed)] //~ ERROR attribute should be applied to a struct or union | ||
pub enum Foo { | ||
Bar, | ||
Baz(i32), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error: unused attribute | ||
--> $DIR/repr-empty-packed.rs:4:1 | ||
| | ||
LL | #[repr()] | ||
| ^^^^^^^^^ help: remove this attribute | ||
| | ||
= note: attribute `repr` with an empty list has no effect | ||
note: the lint level is defined here | ||
--> $DIR/repr-empty-packed.rs:2:9 | ||
| | ||
LL | #![deny(unused_attributes)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0517]: attribute should be applied to a struct or union | ||
--> $DIR/repr-empty-packed.rs:5:8 | ||
| | ||
LL | #[repr(packed)] | ||
| ^^^^^^ | ||
LL | / pub enum Foo { | ||
LL | | Bar, | ||
LL | | Baz(i32), | ||
LL | | } | ||
| |_- not a struct or union | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0517`. |