about summary refs log tree commit diff
path: root/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
blob: c5059c002b4bf763832224a26a39a6d4c17acb16 (plain)
1
2
3
4
5
6
7
8
9
10
11
//@ run-fail
//@ error-pattern:attempt to negate with overflow
//@ needs-subprocess
//@ compile-flags: -C debug-assertions
#![allow(arithmetic_overflow)]

use std::num::NonZero;

fn main() {
    let _x = -NonZero::new(i8::MIN).unwrap();
}