rust/tests/ui/enums_clike.rs

52 lines
811 B
Rust
Raw Normal View History

// ignore-x86
2017-09-18 05:47:33 -05:00
2018-07-28 10:34:52 -05:00
#![warn(clippy::all)]
#![allow(unused)]
#[repr(usize)]
enum NonPortable {
2017-02-08 07:58:07 -06:00
X = 0x1_0000_0000,
Y = 0,
Z = 0x7FFF_FFFF,
A = 0xFFFF_FFFF,
}
enum NonPortableNoHint {
2017-02-08 07:58:07 -06:00
X = 0x1_0000_0000,
Y = 0,
Z = 0x7FFF_FFFF,
2017-02-08 07:58:07 -06:00
A = 0xFFFF_FFFF,
}
#[repr(isize)]
enum NonPortableSigned {
X = -1,
Y = 0x7FFF_FFFF,
2017-02-08 07:58:07 -06:00
Z = 0xFFFF_FFFF,
A = 0x1_0000_0000,
B = std::i32::MIN as isize,
2017-02-08 07:58:07 -06:00
C = (std::i32::MIN as isize) - 1,
}
enum NonPortableSignedNoHint {
X = -1,
Y = 0x7FFF_FFFF,
2017-02-08 07:58:07 -06:00
Z = 0xFFFF_FFFF,
A = 0x1_0000_0000,
}
/*
FIXME: uncomment once https://github.com/rust-lang/rust/issues/31910 is fixed
#[repr(usize)]
enum NonPortable2<T: Trait> {
X = Trait::Number,
Y = 0,
}
trait Trait {
const Number: usize = 0x1_0000_0000;
}
*/
2018-12-09 16:26:16 -06:00
fn main() {}