Rollup merge of #74109 - nbdd0121:issue-74082, r=petrochenkov
Only allow `repr(i128/u128)` on enum Fixes #74082
This commit is contained in:
commit
8efa197ee4
@ -292,6 +292,8 @@ fn check_repr(
|
|||||||
| sym::u32
|
| sym::u32
|
||||||
| sym::i64
|
| sym::i64
|
||||||
| sym::u64
|
| sym::u64
|
||||||
|
| sym::i128
|
||||||
|
| sym::u128
|
||||||
| sym::isize
|
| sym::isize
|
||||||
| sym::usize => {
|
| sym::usize => {
|
||||||
int_reprs += 1;
|
int_reprs += 1;
|
||||||
|
9
src/test/ui/issues/issue-74082.rs
Normal file
9
src/test/ui/issues/issue-74082.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
#[repr(i128)] //~ ERROR: attribute should be applied to enum
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
#[repr(u128)] //~ ERROR: attribute should be applied to enum
|
||||||
|
struct Bar;
|
||||||
|
|
||||||
|
fn main() {}
|
19
src/test/ui/issues/issue-74082.stderr
Normal file
19
src/test/ui/issues/issue-74082.stderr
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
error[E0517]: attribute should be applied to enum
|
||||||
|
--> $DIR/issue-74082.rs:3:8
|
||||||
|
|
|
||||||
|
LL | #[repr(i128)]
|
||||||
|
| ^^^^
|
||||||
|
LL | struct Foo;
|
||||||
|
| ----------- not an enum
|
||||||
|
|
||||||
|
error[E0517]: attribute should be applied to enum
|
||||||
|
--> $DIR/issue-74082.rs:6:8
|
||||||
|
|
|
||||||
|
LL | #[repr(u128)]
|
||||||
|
| ^^^^
|
||||||
|
LL | struct Bar;
|
||||||
|
| ----------- not an enum
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0517`.
|
Loading…
Reference in New Issue
Block a user