@@ -80,38 +80,40 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8080 /// version (resolve_vars_if_possible), this version will
8181 /// also select obligations if it seems useful, in an effort
8282 /// to get more type information.
83- pub ( in super :: super ) fn resolve_vars_with_obligations ( & self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
84- self . resolve_vars_with_obligations_and_mutate_fulfillment ( ty , |_| { } )
83+ pub ( in super :: super ) fn resolve_vars_with_obligations < T : TypeFoldable < ' tcx > > ( & self , t : T ) -> T {
84+ self . resolve_vars_with_obligations_and_mutate_fulfillment ( t , |_| { } )
8585 }
8686
8787 #[ instrument( skip( self , mutate_fulfillment_errors) , level = "debug" ) ]
88- pub ( in super :: super ) fn resolve_vars_with_obligations_and_mutate_fulfillment (
88+ pub ( in super :: super ) fn resolve_vars_with_obligations_and_mutate_fulfillment <
89+ T : TypeFoldable < ' tcx > ,
90+ > (
8991 & self ,
90- mut ty : Ty < ' tcx > ,
92+ mut t : T ,
9193 mutate_fulfillment_errors : impl Fn ( & mut Vec < traits:: FulfillmentError < ' tcx > > ) ,
92- ) -> Ty < ' tcx > {
94+ ) -> T {
9395 // No Infer()? Nothing needs doing.
94- if !ty . has_infer_types_or_consts ( ) {
96+ if !t . has_infer_types_or_consts ( ) {
9597 debug ! ( "no inference var, nothing needs doing" ) ;
96- return ty ;
98+ return t ;
9799 }
98100
99101 // If `ty` is a type variable, see whether we already know what it is.
100- ty = self . resolve_vars_if_possible ( ty ) ;
101- if !ty . has_infer_types_or_consts ( ) {
102- debug ! ( ?ty ) ;
103- return ty ;
102+ t = self . resolve_vars_if_possible ( t ) ;
103+ if !t . has_infer_types_or_consts ( ) {
104+ debug ! ( ?t ) ;
105+ return t ;
104106 }
105107
106108 // If not, try resolving pending obligations as much as
107109 // possible. This can help substantially when there are
108110 // indirect dependencies that don't seem worth tracking
109111 // precisely.
110112 self . select_obligations_where_possible ( false , mutate_fulfillment_errors) ;
111- ty = self . resolve_vars_if_possible ( ty ) ;
113+ t = self . resolve_vars_if_possible ( t ) ;
112114
113- debug ! ( ?ty ) ;
114- ty
115+ debug ! ( ?t ) ;
116+ t
115117 }
116118
117119 pub ( in super :: super ) fn record_deferred_call_resolution (
0 commit comments