mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Support allocation failures when interperting MIR
Note that this breaks Miri. Closes #79601
This commit is contained in:
parent
b186f8605a
commit
6048adc8b1
@ -72,7 +72,10 @@ pub(crate) fn get_vtable<'tcx>(
|
||||
let vtable_ptr = if let Some(vtable_ptr) = fx.vtables.get(&(ty, trait_ref)) {
|
||||
*vtable_ptr
|
||||
} else {
|
||||
let vtable_alloc_id = fx.tcx.vtable_allocation(ty, trait_ref);
|
||||
let vtable_alloc_id = match fx.tcx.vtable_allocation(ty, trait_ref) {
|
||||
Ok(alloc) => alloc,
|
||||
Err(_) => fx.tcx.sess().fatal("allocation of constant vtable failed"),
|
||||
};
|
||||
let vtable_allocation = fx.tcx.global_alloc(vtable_alloc_id).unwrap_memory();
|
||||
let vtable_ptr = pointer_for_allocation(fx, vtable_allocation);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user