22//! traits, `Copy`/`Clone`. 
33
44use  rustc_ast_ir:: { Movability ,  Mutability } ; 
5- use  rustc_data_structures :: fx :: FxHashMap ; 
5+ use  rustc_type_ir :: data_structures :: HashMap ; 
66use  rustc_type_ir:: fold:: { TypeFoldable ,  TypeFolder ,  TypeSuperFoldable } ; 
77use  rustc_type_ir:: inherent:: * ; 
88use  rustc_type_ir:: lang_items:: TraitSolverLangItem ; 
@@ -304,9 +304,10 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<I: Intern
304304            let  kind_ty = args. kind_ty ( ) ; 
305305            let  sig = args. coroutine_closure_sig ( ) . skip_binder ( ) ; 
306306
307-             let  coroutine_ty = if  let  Some ( closure_kind)  = kind_ty. to_opt_closure_kind ( ) 
308-                 && !args. tupled_upvars_ty ( ) . is_ty_var ( ) 
309-             { 
307+             // FIXME: let_chains 
308+             let  kind = kind_ty. to_opt_closure_kind ( ) ; 
309+             let  coroutine_ty = if  kind. is_some ( )  && !args. tupled_upvars_ty ( ) . is_ty_var ( )  { 
310+                 let  closure_kind = kind. unwrap ( ) ; 
310311                if  !closure_kind. extends ( goal_kind)  { 
311312                    return  Err ( NoSolution ) ; 
312313                } 
@@ -411,10 +412,11 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
411412            let  kind_ty = args. kind_ty ( ) ; 
412413            let  sig = args. coroutine_closure_sig ( ) . skip_binder ( ) ; 
413414            let  mut  nested = vec ! [ ] ; 
414-             let  coroutine_ty = if  let  Some ( closure_kind)  = kind_ty. to_opt_closure_kind ( ) 
415-                 && !args. tupled_upvars_ty ( ) . is_ty_var ( ) 
416-             { 
417-                 if  !closure_kind. extends ( goal_kind)  { 
415+ 
416+             // FIXME: let_chains 
417+             let  kind = kind_ty. to_opt_closure_kind ( ) ; 
418+             let  coroutine_ty = if  kind. is_some ( )  && !args. tupled_upvars_ty ( ) . is_ty_var ( )  { 
419+                 if  !kind. unwrap ( ) . extends ( goal_kind)  { 
418420                    return  Err ( NoSolution ) ; 
419421                } 
420422
@@ -683,7 +685,7 @@ where
683685        ) ; 
684686    } 
685687
686-     let  mut  replace_projection_with = FxHashMap :: default ( ) ; 
688+     let  mut  replace_projection_with = HashMap :: default ( ) ; 
687689    for  bound in  object_bounds { 
688690        if  let  ty:: ExistentialPredicate :: Projection ( proj)  = bound. skip_binder ( )  { 
689691            let  proj = proj. with_self_ty ( tcx,  trait_ref. self_ty ( ) ) ; 
@@ -713,7 +715,7 @@ where
713715struct  ReplaceProjectionWith < ' a ,  Infcx :  SolverDelegate < Interner  = I > ,  I :  Interner >  { 
714716    ecx :  & ' a  EvalCtxt < ' a ,  Infcx > , 
715717    param_env :  I :: ParamEnv , 
716-     mapping :  FxHashMap < I :: DefId ,  ty:: Binder < I ,  ty:: ProjectionPredicate < I > > > , 
718+     mapping :  HashMap < I :: DefId ,  ty:: Binder < I ,  ty:: ProjectionPredicate < I > > > , 
717719    nested :  Vec < Goal < I ,  I :: Predicate > > , 
718720} 
719721
@@ -725,24 +727,28 @@ impl<Infcx: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I>
725727    } 
726728
727729    fn  fold_ty ( & mut  self ,  ty :  I :: Ty )  -> I :: Ty  { 
728-         if  let  ty:: Alias ( ty:: Projection ,  alias_ty)  = ty. kind ( ) 
729-             && let  Some ( replacement)  = self . mapping . get ( & alias_ty. def_id ) 
730-         { 
731-             // We may have a case where our object type's projection bound is higher-ranked, 
732-             // but the where clauses we instantiated are not. We can solve this by instantiating 
733-             // the binder at the usage site. 
734-             let  proj = self . ecx . instantiate_binder_with_infer ( * replacement) ; 
735-             // FIXME: Technically this equate could be fallible... 
736-             self . nested . extend ( 
737-                 self . ecx 
738-                     . eq_and_get_goals ( 
739-                         self . param_env , 
740-                         alias_ty, 
741-                         proj. projection_term . expect_ty ( self . ecx . interner ( ) ) , 
742-                     ) 
743-                     . expect ( "expected to be able to unify goal projection with dyn's projection" ) , 
744-             ) ; 
745-             proj. term . expect_ty ( ) 
730+         if  let  ty:: Alias ( ty:: Projection ,  alias_ty)  = ty. kind ( )  { 
731+             if  let  Some ( replacement)  = self . mapping . get ( & alias_ty. def_id )  { 
732+                 // We may have a case where our object type's projection bound is higher-ranked, 
733+                 // but the where clauses we instantiated are not. We can solve this by instantiating 
734+                 // the binder at the usage site. 
735+                 let  proj = self . ecx . instantiate_binder_with_infer ( * replacement) ; 
736+                 // FIXME: Technically this equate could be fallible... 
737+                 self . nested . extend ( 
738+                     self . ecx 
739+                         . eq_and_get_goals ( 
740+                             self . param_env , 
741+                             alias_ty, 
742+                             proj. projection_term . expect_ty ( self . ecx . interner ( ) ) , 
743+                         ) 
744+                         . expect ( 
745+                             "expected to be able to unify goal projection with dyn's projection" , 
746+                         ) , 
747+                 ) ; 
748+                 proj. term . expect_ty ( ) 
749+             }  else  { 
750+                 ty. super_fold_with ( self ) 
751+             } 
746752        }  else  { 
747753            ty. super_fold_with ( self ) 
748754        } 
0 commit comments