Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HACK: avoid an existing ICE
  • Loading branch information
lcnr committed Jan 17, 2025
commit b7f8ceb75f4fda67737a9ed720bf34b2513b7516
10 changes: 7 additions & 3 deletions compiler/rustc_middle/src/mir/tcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ impl<'tcx> PlaceTy<'tcx> {
}
let answer = match *elem {
ProjectionElem::Deref => {
let ty = self.ty.builtin_deref(true).unwrap_or_else(|| {
bug!("deref projection of non-dereferenceable ty {:?}", self)
});
let pointee_ty = self.ty;
let ty = pointee_ty
.builtin_deref(true)
.or_else(|| Some(Ty::new_error(tcx, pointee_ty.error_reported().err()?)))
.unwrap_or_else(|| {
bug!("deref projection of non-dereferenceable ty {:?}", self)
});
PlaceTy::from_ty(ty)
}
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => {
Expand Down