2015-03-30 06:26:02 -05:00
|
|
|
// Evaluation of constants in refutable patterns goes through
|
|
|
|
// different compiler control-flow paths.
|
|
|
|
|
2022-09-21 06:05:20 -05:00
|
|
|
#![allow(unused_imports, warnings)]
|
2015-03-30 06:26:02 -05:00
|
|
|
|
|
|
|
use std::fmt;
|
|
|
|
use std::{i8, i16, i32, i64, isize};
|
|
|
|
use std::{u8, u16, u32, u64, usize};
|
|
|
|
|
|
|
|
const NEG_128: i8 = -128;
|
2022-09-21 06:05:20 -05:00
|
|
|
const NEG_NEG_128: i8 = -NEG_128; //~ ERROR constant
|
2015-03-30 06:26:02 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
match -128i8 {
|
2017-12-10 14:29:24 -06:00
|
|
|
NEG_NEG_128 => println!("A"),
|
2018-06-02 16:38:57 -05:00
|
|
|
//~^ ERROR could not evaluate constant pattern
|
2020-01-08 11:02:10 -06:00
|
|
|
//~| ERROR could not evaluate constant pattern
|
2015-03-30 06:26:02 -05:00
|
|
|
_ => println!("B"),
|
|
|
|
}
|
|
|
|
}
|