@@ -80,38 +80,40 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
80
80
/// version (resolve_vars_if_possible), this version will
81
81
/// also select obligations if it seems useful, in an effort
82
82
/// 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 , |_| { } )
85
85
}
86
86
87
87
#[ 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
+ > (
89
91
& self ,
90
- mut ty : Ty < ' tcx > ,
92
+ mut t : T ,
91
93
mutate_fulfillment_errors : impl Fn ( & mut Vec < traits:: FulfillmentError < ' tcx > > ) ,
92
- ) -> Ty < ' tcx > {
94
+ ) -> T {
93
95
// No Infer()? Nothing needs doing.
94
- if !ty . has_infer_types_or_consts ( ) {
96
+ if !t . has_infer_types_or_consts ( ) {
95
97
debug ! ( "no inference var, nothing needs doing" ) ;
96
- return ty ;
98
+ return t ;
97
99
}
98
100
99
101
// 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 ;
104
106
}
105
107
106
108
// If not, try resolving pending obligations as much as
107
109
// possible. This can help substantially when there are
108
110
// indirect dependencies that don't seem worth tracking
109
111
// precisely.
110
112
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 ) ;
112
114
113
- debug ! ( ?ty ) ;
114
- ty
115
+ debug ! ( ?t ) ;
116
+ t
115
117
}
116
118
117
119
pub ( in super :: super ) fn record_deferred_call_resolution (
0 commit comments