Skip to content

Commit

Permalink
HACK: avoid an existing ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jan 15, 2025
1 parent 12f29ba commit ccc892f
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit ccc892f

Please sign in to comment.