2024-03-13 09:07:47 -05:00
|
|
|
//@revisions: noopt opt
|
2024-03-18 11:54:48 -05:00
|
|
|
//@[noopt] compile-flags: -Copt-level=0
|
2024-03-13 09:07:47 -05:00
|
|
|
//@[opt] compile-flags: -O
|
2024-03-21 07:53:00 -05:00
|
|
|
//! Make sure we evaluate const fn calls even if they get promoted and their result ignored.
|
2024-03-13 09:07:47 -05:00
|
|
|
|
|
|
|
const unsafe fn ub() {
|
|
|
|
std::hint::unreachable_unchecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const FOO: () = unsafe {
|
|
|
|
// Make sure that this gets promoted and then fails to evaluate, and we deal with that
|
|
|
|
// correctly.
|
|
|
|
let _x: &'static () = &ub(); //~ erroneous constant
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {}
|