1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-tidy-linelength
13 // Issue 23030: Detect overflowing discriminant
15 // Check that we detect the overflow even if enum is not used.
17 // See also run-pass/discrim-explicit-23030.rs where the suggested
18 // workaround is tested.
20 use std
::{i8,u8,i16,u16,i32,u32,i64, u64}
;
27 OhNo
, //~ ERROR enum discriminant overflowed on value after 127i8; set explicitly via OhNo = -128i8 if that is desired outcome
36 OhNo
, //~ ERROR enum discriminant overflowed on value after 255u8; set explicitly via OhNo = 0u8 if that is desired outcome
45 OhNo
, //~ ERROR enum discriminant overflowed
54 OhNo
, //~ ERROR enum discriminant overflowed
63 OhNo
, //~ ERROR enum discriminant overflowed
72 OhNo
, //~ ERROR enum discriminant overflowed
81 OhNo
, //~ ERROR enum discriminant overflowed
90 OhNo
, //~ ERROR enum discriminant overflowed