@@ -427,13 +427,20 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
427427                        chalk_ir:: FloatTy :: F64  => ty:: Float ( ast:: FloatTy :: F64 ) , 
428428                    } , 
429429                } , 
430-                 chalk_ir:: TypeName :: Array  => unimplemented ! ( ) , 
430+                 chalk_ir:: TypeName :: Array  => { 
431+                     let  substs = application_ty. substitution . as_slice ( interner) ; 
432+                     let  ty = substs[ 0 ] . assert_ty_ref ( interner) . lower_into ( interner) ; 
433+                     let  c = substs[ 1 ] . assert_const_ref ( interner) . lower_into ( interner) ; 
434+                     ty:: Array ( ty,  interner. tcx . mk_const ( c) ) 
435+                 } 
431436                chalk_ir:: TypeName :: FnDef ( id)  => { 
432437                    ty:: FnDef ( id. 0 ,  application_ty. substitution . lower_into ( interner) ) 
433438                } 
434439                chalk_ir:: TypeName :: Closure ( closure)  => { 
435440                    ty:: Closure ( closure. 0 ,  application_ty. substitution . lower_into ( interner) ) 
436441                } 
442+                 chalk_ir:: TypeName :: Generator ( _)  => unimplemented ! ( ) , 
443+                 chalk_ir:: TypeName :: GeneratorWitness ( _)  => unimplemented ! ( ) , 
437444                chalk_ir:: TypeName :: Never  => ty:: Never , 
438445                chalk_ir:: TypeName :: Tuple ( _size)  => { 
439446                    ty:: Tuple ( application_ty. substitution . lower_into ( interner) ) 
@@ -483,7 +490,15 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
483490                universe :  ty:: UniverseIndex :: from_usize ( placeholder. ui . counter ) , 
484491                name :  ty:: BoundVar :: from_usize ( placeholder. idx ) , 
485492            } ) , 
486-             TyData :: Alias ( _alias_ty)  => unimplemented ! ( ) , 
493+             chalk_ir:: TyData :: Alias ( alias_ty)  => match  alias_ty { 
494+                 chalk_ir:: AliasTy :: Projection ( projection)  => ty:: Projection ( ty:: ProjectionTy  { 
495+                     item_def_id :  projection. associated_ty_id . 0 , 
496+                     substs :  projection. substitution . lower_into ( interner) , 
497+                 } ) , 
498+                 chalk_ir:: AliasTy :: Opaque ( opaque)  => { 
499+                     ty:: Opaque ( opaque. opaque_ty_id . 0 ,  opaque. substitution . lower_into ( interner) ) 
500+                 } 
501+             } , 
487502            TyData :: Function ( _quantified_ty)  => unimplemented ! ( ) , 
488503            TyData :: BoundVar ( _bound)  => ty:: Bound ( 
489504                ty:: DebruijnIndex :: from_usize ( _bound. debruijn . depth ( )  as  usize ) , 
@@ -519,8 +534,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Lifetime<RustInterner<'tcx>>> for Region<'t
519534                ty:: BrEnv  => unimplemented ! ( ) , 
520535            } , 
521536            ReFree ( _)  => unimplemented ! ( ) , 
522-             // FIXME(chalk): need to handle ReStatic 
523-             ReStatic  => unimplemented ! ( ) , 
537+             ReStatic  => chalk_ir:: LifetimeData :: Static . intern ( interner) , 
524538            ReVar ( _)  => unimplemented ! ( ) , 
525539            RePlaceholder ( placeholder_region)  => { 
526540                chalk_ir:: LifetimeData :: Placeholder ( chalk_ir:: PlaceholderIndex  { 
@@ -550,6 +564,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
550564                    name :  ty:: BoundRegion :: BrAnon ( p. idx  as  u32 ) , 
551565                } ) 
552566            } 
567+             chalk_ir:: LifetimeData :: Static  => ty:: RegionKind :: ReStatic , 
553568            chalk_ir:: LifetimeData :: Phantom ( _,  _)  => unimplemented ! ( ) , 
554569        } ; 
555570        interner. tcx . mk_region ( kind) 
@@ -701,7 +716,16 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<Ru
701716                    } ) , 
702717                ) 
703718            } 
704-             ty:: ExistentialPredicate :: Projection ( _predicate)  => unimplemented ! ( ) , 
719+             ty:: ExistentialPredicate :: Projection ( predicate)  => chalk_ir:: Binders :: new ( 
720+                 chalk_ir:: VariableKinds :: empty ( interner) , 
721+                 chalk_ir:: WhereClause :: AliasEq ( chalk_ir:: AliasEq  { 
722+                     alias :  chalk_ir:: AliasTy :: Projection ( chalk_ir:: ProjectionTy  { 
723+                         associated_ty_id :  chalk_ir:: AssocTypeId ( predicate. item_def_id ) , 
724+                         substitution :  predicate. substs . lower_into ( interner) , 
725+                     } ) , 
726+                     ty :  predicate. ty . lower_into ( interner) , 
727+                 } ) , 
728+             ) , 
705729            ty:: ExistentialPredicate :: AutoTrait ( def_id)  => chalk_ir:: Binders :: new ( 
706730                chalk_ir:: VariableKinds :: empty ( interner) , 
707731                chalk_ir:: WhereClause :: Implemented ( chalk_ir:: TraitRef  { 
@@ -1035,17 +1059,12 @@ impl<'tcx> TypeVisitor<'tcx> for PlaceholdersCollector {
10351059/// Used to substitute specific `Regions`s with placeholders. 
10361060crate  struct  RegionsSubstitutor < ' tcx >  { 
10371061    tcx :  TyCtxt < ' tcx > , 
1038-     restatic_placeholder :  ty:: Region < ' tcx > , 
10391062    reempty_placeholder :  ty:: Region < ' tcx > , 
10401063} 
10411064
10421065impl < ' tcx >  RegionsSubstitutor < ' tcx >  { 
1043-     crate  fn  new ( 
1044-         tcx :  TyCtxt < ' tcx > , 
1045-         restatic_placeholder :  ty:: Region < ' tcx > , 
1046-         reempty_placeholder :  ty:: Region < ' tcx > , 
1047-     )  -> Self  { 
1048-         RegionsSubstitutor  {  tcx,  restatic_placeholder,  reempty_placeholder } 
1066+     crate  fn  new ( tcx :  TyCtxt < ' tcx > ,  reempty_placeholder :  ty:: Region < ' tcx > )  -> Self  { 
1067+         RegionsSubstitutor  {  tcx,  reempty_placeholder } 
10491068    } 
10501069} 
10511070
@@ -1056,7 +1075,6 @@ impl<'tcx> TypeFolder<'tcx> for RegionsSubstitutor<'tcx> {
10561075
10571076    fn  fold_region ( & mut  self ,  r :  Region < ' tcx > )  -> Region < ' tcx >  { 
10581077        match  r { 
1059-             ty:: ReStatic  => self . restatic_placeholder , 
10601078            ty:: ReEmpty ( ui)  => { 
10611079                assert_eq ! ( ui. as_usize( ) ,  0 ) ; 
10621080                self . reempty_placeholder 
0 commit comments