test for "erroneous constant used" post-monomorphization error
This commit is contained in:
parent
3b8b6aa8b6
commit
d585b92fe3
@ -182,7 +182,11 @@ pub fn report_error<'tcx, 'mir>(
|
||||
"Undefined Behavior",
|
||||
ResourceExhaustion(_) =>
|
||||
"resource exhaustion",
|
||||
InvalidProgram(InvalidProgramInfo::AlreadyReported(_) | InvalidProgramInfo::Layout(..)) =>
|
||||
InvalidProgram(
|
||||
InvalidProgramInfo::AlreadyReported(_) |
|
||||
InvalidProgramInfo::Layout(..) |
|
||||
InvalidProgramInfo::ReferencedConstant
|
||||
) =>
|
||||
"post-monomorphization error",
|
||||
kind =>
|
||||
bug!("This error should be impossible in Miri: {:?}", kind),
|
||||
|
12
tests/compile-fail/erroneous_const2.rs
Normal file
12
tests/compile-fail/erroneous_const2.rs
Normal file
@ -0,0 +1,12 @@
|
||||
const X: u32 = 5;
|
||||
const Y: u32 = 6;
|
||||
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
|
||||
//~^ERROR any use of this value
|
||||
//~|WARN previously accepted
|
||||
|
||||
fn main() {
|
||||
println!("{}", FOO); //~ERROR post-monomorphization error
|
||||
//~|ERROR evaluation of constant value failed
|
||||
//~|ERROR erroneous constant used
|
||||
//~|WARN previously accepted
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user