about summary refs log tree commit diff
path: root/tests/ui/precondition-checks/cfg-ub-checks-no.rs
blob: 73705a7e63287ee87add360e8eba95709252bcc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ run-pass
//@ compile-flags: -Zub-checks=no

#![feature(cfg_ub_checks)]

fn main() {
    assert!(!cfg!(ub_checks));
    assert!(compiles_differently());
}

#[cfg(ub_checks)]
fn compiles_differently() -> bool {
    false
}

#[cfg(not(ub_checks))]
fn compiles_differently() -> bool {
    true
}