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:
commit
e1068cf211
3 changed files with 8 additions and 4 deletions
|
|
@ -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),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
6
tests/compile-fail/type-too-large.rs
Normal file
6
tests/compile-fail/type-too-large.rs
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue