diff options
| author | Smitty <me@smitop.com> | 2021-06-12 19:49:48 -0400 |
|---|---|---|
| committer | Smitty <me@smitop.com> | 2021-06-29 19:08:26 -0400 |
| commit | 6048adc8b1cc5db39af736cf4531c46059b6966d (patch) | |
| tree | d4e091f77f0f9d7c1d896f5e6bf038f20adf28d8 /src/vtable.rs | |
| parent | b186f8605ad43de1eda87b6e7b981c233a6640db (diff) | |
Support allocation failures when interperting MIR
Note that this breaks Miri. Closes #79601
Diffstat (limited to 'src/vtable.rs')
| -rw-r--r-- | src/vtable.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vtable.rs b/src/vtable.rs index 12f7092d935..5788aabaadc 100644 --- a/src/vtable.rs +++ b/src/vtable.rs @@ -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); |
