]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-eval-overflow-2.rs
Rollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514
[rust.git] / src / test / ui / consts / const-eval / const-eval-overflow-2.rs
1 // Evaluation of constants in refutable patterns goes through
2 // different compiler control-flow paths.
3
4 #![allow(unused_imports, warnings)]
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;
11 const NEG_NEG_128: i8 = -NEG_128; //~ ERROR constant
12
13 fn main() {
14     match -128i8 {
15         NEG_NEG_128 => println!("A"),
16         //~^ ERROR could not evaluate constant pattern
17         //~| ERROR could not evaluate constant pattern
18         _ => println!("B"),
19     }
20 }