We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12f29ba commit ccc892fCopy full SHA for ccc892f
compiler/rustc_middle/src/mir/tcx.rs
@@ -114,9 +114,13 @@ impl<'tcx> PlaceTy<'tcx> {
114
}
115
let answer = match *elem {
116
ProjectionElem::Deref => {
117
- let ty = self.ty.builtin_deref(true).unwrap_or_else(|| {
118
- bug!("deref projection of non-dereferenceable ty {:?}", self)
119
- });
+ let pointee_ty = self.ty;
+ let ty = pointee_ty
+ .builtin_deref(true)
120
+ .or_else(|| Some(Ty::new_error(tcx, pointee_ty.error_reported().err()?)))
121
+ .unwrap_or_else(|| {
122
+ bug!("deref projection of non-dereferenceable ty {:?}", self)
123
+ });
124
PlaceTy::from_ty(ty)
125
126
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => {
0 commit comments