@@ -10,7 +10,7 @@ use crate::{
1010 lang_items:: is_box,
1111 mapping:: ToChalk ,
1212 CallableDefId , ClosureId , Const , ConstScalar , InferenceResult , Interner , MemoryMap ,
13- Substitution , TraitEnvironment , Ty , TyKind ,
13+ Substitution , TraitEnvironment , Ty , TyExt , TyKind ,
1414} ;
1515use base_db:: CrateId ;
1616use chalk_ir:: Mutability ;
@@ -144,6 +144,13 @@ impl<V, T> ProjectionElem<V, T> {
144144 closure_field : impl FnOnce ( ClosureId , & Substitution , usize ) -> Ty ,
145145 krate : CrateId ,
146146 ) -> 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+
147154 if matches ! ( base. kind( Interner ) , TyKind :: Alias ( _) | TyKind :: AssociatedType ( ..) ) {
148155 base = normalize (
149156 db,
@@ -166,7 +173,7 @@ impl<V, T> ProjectionElem<V, T> {
166173 TyKind :: Error . intern ( Interner )
167174 }
168175 } ,
169- ProjectionElem :: Field ( Either :: Left ( f) ) => match & base. kind ( Interner ) {
176+ ProjectionElem :: Field ( Either :: Left ( f) ) => match base. kind ( Interner ) {
170177 TyKind :: Adt ( _, subst) => {
171178 db. field_types ( f. parent ) [ f. local_id ] . clone ( ) . substitute ( Interner , subst)
172179 }
0 commit comments