mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Fix project_deref() implementation
I'm not really sure what is wrong here, but I was getting load type mismatches in the debuginfo code (which is the only place using this function). Replacing the project_deref() implementation with a generic load_operand + deref did the trick.
This commit is contained in:
parent
4560efe46c
commit
208173f8e9
@ -274,7 +274,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
match *elem {
|
||||
mir::ProjectionElem::Deref => {
|
||||
indirect_offsets.push(Size::ZERO);
|
||||
place = place.project_deref(bx);
|
||||
place = bx.load_operand(place).deref(bx.cx());
|
||||
}
|
||||
mir::ProjectionElem::Field(field, _) => {
|
||||
let i = field.index();
|
||||
|
@ -402,18 +402,6 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
||||
downcast
|
||||
}
|
||||
|
||||
pub fn project_deref<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) -> Self {
|
||||
let target_ty = self.layout.ty.builtin_deref(true).expect("failed to deref");
|
||||
let layout = bx.layout_of(target_ty.ty);
|
||||
|
||||
PlaceRef {
|
||||
llval: bx.load(bx.backend_type(layout), self.llval, self.align),
|
||||
llextra: None,
|
||||
layout,
|
||||
align: layout.align.abi,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn storage_live<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) {
|
||||
bx.lifetime_start(self.llval, self.layout.size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user