2016-05-13 11:45:53 +00:00
|
|
|
// ignore-x86
|
2017-09-18 10:47:33 +00:00
|
|
|
|
2020-01-30 02:43:19 +00:00
|
|
|
#![warn(clippy::enum_clike_unportable_variant)]
|
|
|
|
#![allow(unused, non_upper_case_globals)]
|
2016-02-29 08:36:13 +00:00
|
|
|
|
|
|
|
#[repr(usize)]
|
|
|
|
enum NonPortable {
|
2017-02-08 13:58:07 +00:00
|
|
|
X = 0x1_0000_0000,
|
2016-02-29 08:36:13 +00:00
|
|
|
Y = 0,
|
|
|
|
Z = 0x7FFF_FFFF,
|
|
|
|
A = 0xFFFF_FFFF,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum NonPortableNoHint {
|
2017-02-08 13:58:07 +00:00
|
|
|
X = 0x1_0000_0000,
|
2016-02-29 08:36:13 +00:00
|
|
|
Y = 0,
|
|
|
|
Z = 0x7FFF_FFFF,
|
2017-02-08 13:58:07 +00:00
|
|
|
A = 0xFFFF_FFFF,
|
2016-02-29 08:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(isize)]
|
|
|
|
enum NonPortableSigned {
|
|
|
|
X = -1,
|
|
|
|
Y = 0x7FFF_FFFF,
|
2017-02-08 13:58:07 +00:00
|
|
|
Z = 0xFFFF_FFFF,
|
|
|
|
A = 0x1_0000_0000,
|
2016-02-29 08:36:13 +00:00
|
|
|
B = std::i32::MIN as isize,
|
2017-02-08 13:58:07 +00:00
|
|
|
C = (std::i32::MIN as isize) - 1,
|
2016-02-29 08:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum NonPortableSignedNoHint {
|
|
|
|
X = -1,
|
|
|
|
Y = 0x7FFF_FFFF,
|
2017-02-08 13:58:07 +00:00
|
|
|
Z = 0xFFFF_FFFF,
|
|
|
|
A = 0x1_0000_0000,
|
2016-02-29 08:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(usize)]
|
2020-01-30 02:43:19 +00:00
|
|
|
enum NonPortable2 {
|
|
|
|
X = <usize as Trait>::Number,
|
2016-02-29 08:36:13 +00:00
|
|
|
Y = 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait {
|
|
|
|
const Number: usize = 0x1_0000_0000;
|
|
|
|
}
|
2020-01-30 02:43:19 +00:00
|
|
|
|
|
|
|
impl Trait for usize {}
|
2016-02-29 08:36:13 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
fn main() {}
|