about summary refs log tree commit diff
path: root/tests/ui/precondition-checks/nonzero-new_unchecked.rs
blob: 7827a42844fd4eac2d09d5913795cf361eeae19e (plain)
1
2
3
4
5
6
7
8
9
//@ run-fail
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes
//@ error-pattern: unsafe precondition(s) violated: NonZero::new_unchecked requires

fn main() {
    unsafe {
        std::num::NonZeroU8::new_unchecked(0);
    }
}