]> git.lizzy.rs Git - rust.git/blob - tests/ui/enums_clike.rs
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
[rust.git] / tests / ui / enums_clike.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 // ignore-x86
11
12 #![warn(clippy::all)]
13 #![allow(unused)]
14
15 #[repr(usize)]
16 enum NonPortable {
17     X = 0x1_0000_0000,
18     Y = 0,
19     Z = 0x7FFF_FFFF,
20     A = 0xFFFF_FFFF,
21 }
22
23 enum NonPortableNoHint {
24     X = 0x1_0000_0000,
25     Y = 0,
26     Z = 0x7FFF_FFFF,
27     A = 0xFFFF_FFFF,
28 }
29
30 #[repr(isize)]
31 enum NonPortableSigned {
32     X = -1,
33     Y = 0x7FFF_FFFF,
34     Z = 0xFFFF_FFFF,
35     A = 0x1_0000_0000,
36     B = std::i32::MIN as isize,
37     C = (std::i32::MIN as isize) - 1,
38 }
39
40 enum NonPortableSignedNoHint {
41     X = -1,
42     Y = 0x7FFF_FFFF,
43     Z = 0xFFFF_FFFF,
44     A = 0x1_0000_0000,
45 }
46
47 /*
48 FIXME: uncomment once https://github.com/rust-lang/rust/issues/31910 is fixed
49 #[repr(usize)]
50 enum NonPortable2<T: Trait> {
51     X = Trait::Number,
52     Y = 0,
53 }
54
55 trait Trait {
56     const Number: usize = 0x1_0000_0000;
57 }
58 */
59
60 fn main() {}