Rollup merge of - nbdd0121:issue-74082, r=petrochenkov

Only allow `repr(i128/u128)` on enum

Fixes 
This commit is contained in:
Manish Goregaokar 2020-07-10 23:26:41 -07:00 committed by GitHub
commit 8efa197ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 0 deletions
src

View File

@ -292,6 +292,8 @@ fn check_repr(
| sym::u32
| sym::i64
| sym::u64
| sym::i128
| sym::u128
| sym::isize
| sym::usize => {
int_reprs += 1;

View 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() {}

View 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`.