@@ -82,33 +82,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
82
82
let local = Local :: new ( argument_index + 1 ) ;
83
83
84
84
let mir_input_ty = body. local_decls [ local] . ty ;
85
- // FIXME(jackh726): This is a hack. It's somewhat like
86
- // `rustc_traits::normalize_after_erasing_regions`. Ideally, we'd
87
- // like to normalize *before* inserting into `local_decls`, but I
88
- // couldn't figure out where the heck that was.
89
- let mir_input_ty = match self
90
- . infcx
91
- . at ( & ObligationCause :: dummy ( ) , ty:: ParamEnv :: empty ( ) )
92
- . normalize ( mir_input_ty)
93
- {
94
- Ok ( n) => {
95
- debug ! ( "equate_inputs_and_outputs: {:?}" , n) ;
96
- if n. obligations . iter ( ) . all ( |o| {
97
- matches ! (
98
- o. predicate. kind( ) . skip_binder( ) ,
99
- ty:: PredicateKind :: RegionOutlives ( _)
100
- )
101
- } ) {
102
- n. value
103
- } else {
104
- mir_input_ty
105
- }
106
- }
107
- Err ( _) => {
108
- debug ! ( "equate_inputs_and_outputs: NoSolution" ) ;
109
- mir_input_ty
110
- }
111
- } ;
112
85
let mir_input_span = body. local_decls [ local] . source_info . span ;
113
86
self . equate_normalized_input_or_output (
114
87
normalized_input_ty,
@@ -191,17 +164,48 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
191
164
fn equate_normalized_input_or_output ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > , span : Span ) {
192
165
debug ! ( "equate_normalized_input_or_output(a={:?}, b={:?})" , a, b) ;
193
166
194
- if let Err ( terr ) =
167
+ if let Err ( _ ) =
195
168
self . eq_types ( a, b, Locations :: All ( span) , ConstraintCategory :: BoringNoLocation )
196
169
{
197
- span_mirbug ! (
198
- self ,
199
- Location :: START ,
200
- "equate_normalized_input_or_output: `{:?}=={:?}` failed with `{:?}`" ,
201
- a,
202
- b,
203
- terr
204
- ) ;
170
+ // FIXME(jackh726): This is a hack. It's somewhat like
171
+ // `rustc_traits::normalize_after_erasing_regions`. Ideally, we'd
172
+ // like to normalize *before* inserting into `local_decls`, but I
173
+ // couldn't figure out where the heck that was.
174
+ let b = match self
175
+ . infcx
176
+ . at ( & ObligationCause :: dummy ( ) , ty:: ParamEnv :: empty ( ) )
177
+ . normalize ( b)
178
+ {
179
+ Ok ( n) => {
180
+ debug ! ( "equate_inputs_and_outputs: {:?}" , n) ;
181
+ if n. obligations . iter ( ) . all ( |o| {
182
+ matches ! (
183
+ o. predicate. kind( ) . skip_binder( ) ,
184
+ ty:: PredicateKind :: RegionOutlives ( _)
185
+ )
186
+ } ) {
187
+ n. value
188
+ } else {
189
+ b
190
+ }
191
+ }
192
+ Err ( _) => {
193
+ debug ! ( "equate_inputs_and_outputs: NoSolution" ) ;
194
+ b
195
+ }
196
+ } ;
197
+ if let Err ( terr) =
198
+ self . eq_types ( a, b, Locations :: All ( span) , ConstraintCategory :: BoringNoLocation )
199
+ {
200
+ span_mirbug ! (
201
+ self ,
202
+ Location :: START ,
203
+ "equate_normalized_input_or_output: `{:?}=={:?}` failed with `{:?}`" ,
204
+ a,
205
+ b,
206
+ terr
207
+ ) ;
208
+ }
205
209
}
206
210
}
207
211
}
0 commit comments