Skip to content

Commit 208173f

Browse files
committed
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.
1 parent 4560efe commit 208173f

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
274274
match *elem {
275275
mir::ProjectionElem::Deref => {
276276
indirect_offsets.push(Size::ZERO);
277-
place = place.project_deref(bx);
277+
place = bx.load_operand(place).deref(bx.cx());
278278
}
279279
mir::ProjectionElem::Field(field, _) => {
280280
let i = field.index();

compiler/rustc_codegen_ssa/src/mir/place.rs

-12
Original file line numberDiff line numberDiff line change
@@ -402,18 +402,6 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
402402
downcast
403403
}
404404

405-
pub fn project_deref<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) -> Self {
406-
let target_ty = self.layout.ty.builtin_deref(true).expect("failed to deref");
407-
let layout = bx.layout_of(target_ty.ty);
408-
409-
PlaceRef {
410-
llval: bx.load(bx.backend_type(layout), self.llval, self.align),
411-
llextra: None,
412-
layout,
413-
align: layout.align.abi,
414-
}
415-
}
416-
417405
pub fn storage_live<Bx: BuilderMethods<'a, 'tcx, Value = V>>(&self, bx: &mut Bx) {
418406
bx.lifetime_start(self.llval, self.layout.size);
419407
}

0 commit comments

Comments
 (0)