2021-03-31 08:09:16 +00:00
|
|
|
// stderr-per-bitwidth
|
2018-07-02 19:00:07 +02:00
|
|
|
|
2018-05-24 11:03:33 +02:00
|
|
|
fn main() {
|
2018-05-25 15:13:54 +02:00
|
|
|
let n: Int = 40;
|
|
|
|
match n {
|
2018-05-28 19:42:11 -07:00
|
|
|
0..=10 => {},
|
2018-09-04 12:26:21 +02:00
|
|
|
10..=BAR => {}, //~ ERROR could not evaluate constant pattern
|
2018-05-24 11:03:33 +02:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-30 09:35:02 +02:00
|
|
|
#[repr(C)]
|
2018-05-24 11:03:33 +02:00
|
|
|
union Foo {
|
|
|
|
f: Int,
|
|
|
|
r: &'static u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_pointer_width="64")]
|
|
|
|
type Int = u64;
|
|
|
|
|
|
|
|
#[cfg(target_pointer_width="32")]
|
|
|
|
type Int = u32;
|
|
|
|
|
2022-06-02 20:30:29 -04:00
|
|
|
const BAR: Int = unsafe { Foo { r: &42 }.f };
|
2022-09-21 13:05:20 +02:00
|
|
|
//~^ ERROR constant
|