]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
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. | |
4 | // | |
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. | |
10 | ||
11 | // Evaluation of constants in refutable patterns goes through | |
12 | // different compiler control-flow paths. | |
13 | ||
14 | #![allow(unused_imports)] | |
15 | ||
16 | use std::fmt; | |
17 | use std::{i8, i16, i32, i64, isize}; | |
18 | use std::{u8, u16, u32, u64, usize}; | |
19 | ||
20 | const NEG_128: i8 = -128; | |
21 | const NEG_NEG_128: i8 = -NEG_128; | |
5bcae85e SL |
22 | //~^ ERROR constant evaluation error |
23 | //~| attempt to negate with overflow | |
c34b1796 AL |
24 | |
25 | fn main() { | |
26 | match -128i8 { | |
5bcae85e | 27 | NEG_NEG_128 => println!("A"), //~ NOTE for pattern here |
c34b1796 AL |
28 | _ => println!("B"), |
29 | } | |
30 | } |