]> git.lizzy.rs Git - rust.git/blob - tests/ui/enums_clike.rs
Add license header to Rust files
[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
11 #![feature(tool_lints)]
12
13 // ignore-x86
14
15
16 #![warn(clippy::all)]
17
18 #![allow(unused)]
19
20 #[repr(usize)]
21 enum NonPortable {
22     X = 0x1_0000_0000,
23     Y = 0,
24     Z = 0x7FFF_FFFF,
25     A = 0xFFFF_FFFF,
26 }
27
28 enum NonPortableNoHint {
29     X = 0x1_0000_0000,
30     Y = 0,
31     Z = 0x7FFF_FFFF,
32     A = 0xFFFF_FFFF,
33 }
34
35 #[repr(isize)]
36 enum NonPortableSigned {
37     X = -1,
38     Y = 0x7FFF_FFFF,
39     Z = 0xFFFF_FFFF,
40     A = 0x1_0000_0000,
41     B = std::i32::MIN as isize,
42     C = (std::i32::MIN as isize) - 1,
43 }
44
45 enum NonPortableSignedNoHint {
46     X = -1,
47     Y = 0x7FFF_FFFF,
48     Z = 0xFFFF_FFFF,
49     A = 0x1_0000_0000,
50 }
51
52 /*
53 FIXME: uncomment once https://github.com/rust-lang/rust/issues/31910 is fixed
54 #[repr(usize)]
55 enum NonPortable2<T: Trait> {
56     X = Trait::Number,
57     Y = 0,
58 }
59
60 trait Trait {
61     const Number: usize = 0x1_0000_0000;
62 }
63 */
64
65 fn main() {
66 }