rust/tests/ui/precondition-checks/cfg-ub-checks-yes.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
296 B
Rust
Raw Normal View History

//@ run-pass
//@ compile-flags: -Zub-checks=yes
#![feature(cfg_ub_checks)]
fn main() {
assert!(cfg!(ub_checks));
assert!(compiles_differently());
}
#[cfg(ub_checks)]
fn compiles_differently() -> bool {
true
}
#[cfg(not(ub_checks))]
fn compiles_differently() -> bool {
false
}