gracefully handle type-too-large layout errors

This commit is contained in:
Ralf Jung 2022-04-30 17:06:50 +02:00
parent cf5e75389d
commit a0ac13d8a1
3 changed files with 8 additions and 4 deletions

View File

@ -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),
};

View File

@ -12,7 +12,7 @@ impl<T> PrintName<T> {
fn no_codegen<T>() {
if false {
let _ = PrintName::<T>::VOID; //~ERROR error occurred: encountered constant
let _ = PrintName::<T>::VOID; //~ERROR post-monomorphization error
}
}
fn main() {

View File

@ -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
}