Auto merge of #2093 - RalfJung:post-mono, r=RalfJung

gracefully handle type-too-large layout errors

Fixes https://github.com/rust-lang/miri/issues/2088
This commit is contained in:
bors 2022-04-30 15:10:05 +00:00
commit e1068cf211
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
}