@@ -10,6 +10,7 @@ use rustc_hir_analysis::astconv::AstConv;
1010use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
1111use rustc_infer:: infer:: LateBoundRegionConversionTime ;
1212use rustc_infer:: infer:: { InferOk , InferResult } ;
13+ use rustc_macros:: { TypeFoldable , TypeVisitable } ;
1314use rustc_middle:: ty:: subst:: InternalSubsts ;
1415use rustc_middle:: ty:: visit:: TypeVisitable ;
1516use rustc_middle:: ty:: { self , Ty } ;
@@ -22,7 +23,7 @@ use std::cmp;
2223use std:: iter;
2324
2425/// What signature do we *expect* the closure to have from context?
25- #[ derive( Debug ) ]
26+ #[ derive( Debug , Clone , TypeFoldable , TypeVisitable ) ]
2627struct ExpectedSig < ' tcx > {
2728 /// Span that gave us this expectation, if we know that.
2829 cause_span : Option < Span > ,
@@ -241,9 +242,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
241242 if expected_sig. is_none ( )
242243 && let ty:: PredicateKind :: Projection ( proj_predicate) = bound_predicate. skip_binder ( )
243244 {
244- expected_sig = self . deduce_sig_from_projection (
245+ expected_sig = self . normalize_associated_types_in (
246+ obligation. cause . span ,
247+ self . deduce_sig_from_projection (
245248 Some ( obligation. cause . span ) ,
246- bound_predicate. rebind ( proj_predicate) ,
249+ bound_predicate. rebind ( proj_predicate) ,
250+ ) ,
247251 ) ;
248252 }
249253
0 commit comments