Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 12 additions & 0 deletions tests/compile-fail/erroneous_const2.rs
Original file line number Diff line number Diff line change
@@ -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
}