]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | // Evaluation of constants in refutable patterns goes through |
2 | // different compiler control-flow paths. | |
3 | ||
2b03887a | 4 | #![allow(unused_imports, warnings)] |
c34b1796 AL |
5 | |
6 | use std::fmt; | |
7 | use std::{i8, i16, i32, i64, isize}; | |
8 | use std::{u8, u16, u32, u64, usize}; | |
9 | ||
10 | const NEG_128: i8 = -128; | |
2b03887a | 11 | const NEG_NEG_128: i8 = -NEG_128; //~ ERROR constant |
c34b1796 AL |
12 | |
13 | fn main() { | |
14 | match -128i8 { | |
ff7c6d11 | 15 | NEG_NEG_128 => println!("A"), |
94b46f34 | 16 | //~^ ERROR could not evaluate constant pattern |
dfeec247 | 17 | //~| ERROR could not evaluate constant pattern |
c34b1796 AL |
18 | _ => println!("B"), |
19 | } | |
20 | } |