summaryrefslogtreecommitdiffstats
path: root/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
blob: 565b7e86fc4b954c875905b45b9bf84a3c912a71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// run-fail
// error-pattern:thread 'main' panicked at 'attempt to negate with overflow'
// ignore-emscripten no processes
// compile-flags: -C debug-assertions

#![allow(arithmetic_overflow)]

use std::num::NonZeroI8;

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