2021-03-31 08:09:16 +00:00
|
|
|
// stderr-per-bitwidth
|
2018-07-02 17:00:07 +00:00
|
|
|
|
2018-05-24 09:03:33 +00:00
|
|
|
fn main() {
|
2018-05-25 13:13:54 +00:00
|
|
|
let n: Int = 40;
|
|
|
|
match n {
|
2018-05-29 02:42:11 +00:00
|
|
|
0..=10 => {},
|
2018-09-04 10:26:21 +00:00
|
|
|
10..=BAR => {}, //~ ERROR could not evaluate constant pattern
|
2020-01-08 17:02:10 +00:00
|
|
|
//~| ERROR could not evaluate constant pattern
|
2018-05-24 09:03:33 +00:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-30 07:35:02 +00:00
|
|
|
#[repr(C)]
|
2018-05-24 09:03:33 +00: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-03 00:30:29 +00:00
|
|
|
const BAR: Int = unsafe { Foo { r: &42 }.f };
|
2022-09-21 11:05:20 +00:00
|
|
|
//~^ ERROR constant
|