diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 1a39a1ff332e..5d20cc6ff6ba 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -182,10 +182,8 @@ pub fn report_error<'tcx, 'mir>( "Undefined Behavior", ResourceExhaustion(_) => "resource exhaustion", - InvalidProgram(InvalidProgramInfo::ReferencedConstant) => + InvalidProgram(InvalidProgramInfo::AlreadyReported(_) | InvalidProgramInfo::Layout(..)) => "post-monomorphization error", - InvalidProgram(InvalidProgramInfo::AlreadyReported(_)) => - "error occurred", kind => bug!("This error should be impossible in Miri: {:?}", kind), }; diff --git a/tests/compile-fail/erroneous_const.rs b/tests/compile-fail/erroneous_const.rs index 2592483fe65a..8975694f51cc 100644 --- a/tests/compile-fail/erroneous_const.rs +++ b/tests/compile-fail/erroneous_const.rs @@ -12,7 +12,7 @@ impl PrintName { fn no_codegen() { if false { - let _ = PrintName::::VOID; //~ERROR error occurred: encountered constant + let _ = PrintName::::VOID; //~ERROR post-monomorphization error } } fn main() { diff --git a/tests/compile-fail/type-too-large.rs b/tests/compile-fail/type-too-large.rs new file mode 100644 index 000000000000..2c4ff7013a46 --- /dev/null +++ b/tests/compile-fail/type-too-large.rs @@ -0,0 +1,6 @@ +// ignore-32bit + +fn main() { + let _fat: [u8; (1<<61)+(1<<31)] = + [0; (1u64<<61) as usize +(1u64<<31) as usize]; //~ ERROR post-monomorphization error +}