@@ -10,7 +10,7 @@ use crate::{
10
10
lang_items:: is_box,
11
11
mapping:: ToChalk ,
12
12
CallableDefId , ClosureId , Const , ConstScalar , InferenceResult , Interner , MemoryMap ,
13
- Substitution , TraitEnvironment , Ty , TyKind ,
13
+ Substitution , TraitEnvironment , Ty , TyExt , TyKind ,
14
14
} ;
15
15
use base_db:: CrateId ;
16
16
use chalk_ir:: Mutability ;
@@ -144,6 +144,13 @@ impl<V, T> ProjectionElem<V, T> {
144
144
closure_field : impl FnOnce ( ClosureId , & Substitution , usize ) -> Ty ,
145
145
krate : CrateId ,
146
146
) -> Ty {
147
+ // we only bail on mir building when there are type mismatches
148
+ // but error types may pop up resulting in us still attempting to build the mir
149
+ // so just propagate the error type
150
+ if base. is_unknown ( ) {
151
+ return TyKind :: Error . intern ( Interner ) ;
152
+ }
153
+
147
154
if matches ! ( base. kind( Interner ) , TyKind :: Alias ( _) | TyKind :: AssociatedType ( ..) ) {
148
155
base = normalize (
149
156
db,
@@ -166,7 +173,7 @@ impl<V, T> ProjectionElem<V, T> {
166
173
TyKind :: Error . intern ( Interner )
167
174
}
168
175
} ,
169
- ProjectionElem :: Field ( Either :: Left ( f) ) => match & base. kind ( Interner ) {
176
+ ProjectionElem :: Field ( Either :: Left ( f) ) => match base. kind ( Interner ) {
170
177
TyKind :: Adt ( _, subst) => {
171
178
db. field_types ( f. parent ) [ f. local_id ] . clone ( ) . substitute ( Interner , subst)
172
179
}
0 commit comments