rust/tests/ui/consts/const-eval/const-eval-overflow-2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
526 B
Rust
Raw Normal View History

// 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)]
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
fn main() {
match -128i8 {
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
_ => println!("B"),
}
}