about summary refs log tree commit diff
path: root/tests/ui/precondition-checks/nonzero-new_unchecked.rs
blob: 978f01f150f08b0fd60c9cb23f35596cd2de5da0 (plain)
1
2
3
4
5
6
7
8
9
//@ run-crash
//@ 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);
    }
}