2019-12-27 13:33:22 -06:00
|
|
|
const fn foo() -> ! {
|
|
|
|
unsafe { std::mem::transmute(()) }
|
2021-06-18 12:31:56 -05:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
2019-12-27 13:33:22 -06:00
|
|
|
}
|
|
|
|
|
2022-04-20 19:00:00 -05:00
|
|
|
// Type defined in a submodule, so that it is not "visibly"
|
|
|
|
// uninhabited (which would change interpreter behavior).
|
|
|
|
pub mod empty {
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
enum Void {}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
pub struct Empty(Void);
|
|
|
|
}
|
2019-12-27 13:33:22 -06:00
|
|
|
|
2022-04-20 19:00:00 -05:00
|
|
|
const FOO: [empty::Empty; 3] = [foo(); 3];
|
2019-12-27 13:33:22 -06:00
|
|
|
|
2022-04-20 19:00:00 -05:00
|
|
|
const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
|
2023-03-21 05:20:00 -05:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
2019-12-27 13:33:22 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
FOO;
|
|
|
|
BAR;
|
|
|
|
}
|