fix ices on vfe about principal trait
This commit is contained in:
@@ -37,6 +37,7 @@ use crate::back::write::{
|
||||
submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
|
||||
};
|
||||
use crate::common::{self, IntPredicate, RealPredicate, TypeKind};
|
||||
use crate::meth::load_vtable;
|
||||
use crate::mir::operand::OperandValue;
|
||||
use crate::mir::place::PlaceRef;
|
||||
use crate::traits::*;
|
||||
@@ -135,14 +136,8 @@ fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
|
||||
if let Some(entry_idx) = vptr_entry_idx {
|
||||
let ptr_size = bx.data_layout().pointer_size;
|
||||
let ptr_align = bx.data_layout().pointer_align.abi;
|
||||
let vtable_byte_offset = u64::try_from(entry_idx).unwrap() * ptr_size.bytes();
|
||||
let gep = bx.inbounds_ptradd(old_info, bx.const_usize(vtable_byte_offset));
|
||||
let new_vptr = bx.load(bx.type_ptr(), gep, ptr_align);
|
||||
bx.nonnull_metadata(new_vptr);
|
||||
// VTable loads are invariant.
|
||||
bx.set_invariant_load(new_vptr);
|
||||
new_vptr
|
||||
load_vtable(bx, old_info, bx.type_ptr(), vtable_byte_offset, source, true)
|
||||
} else {
|
||||
old_info
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user