@@ -182,27 +182,22 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
182
182
return true ;
183
183
}
184
184
185
- let try_equal_with_param_env = |param_env| {
186
- let src = self . tcx . normalize_erasing_regions ( param_env, src) ;
187
- let dest = self . tcx . normalize_erasing_regions ( param_env, dest) ;
188
- // Type-changing assignments can happen when subtyping is used. While
189
- // all normal lifetimes are erased, higher-ranked types with their
190
- // late-bound lifetimes are still around and can lead to type
191
- // differences. So we compare ignoring lifetimes.
192
- equal_up_to_regions ( self . tcx , param_env, src, dest)
193
- } ;
194
-
195
185
// Normalize projections and things like that.
186
+ // Type-changing assignments can happen when subtyping is used. While
187
+ // all normal lifetimes are erased, higher-ranked types with their
188
+ // late-bound lifetimes are still around and can lead to type
189
+ // differences. So we compare ignoring lifetimes.
190
+
196
191
// First, try with reveal_all. This might not work in some cases, as the predicates
197
192
// can be cleared in reveal_all mode. We try the reveal first anyways as it is used
198
193
// by some other passes like inlining as well.
199
194
let param_env = self . param_env . with_reveal_all_normalized ( self . tcx ) ;
200
- if try_equal_with_param_env ( param_env) {
201
- true
202
- } else {
203
- // If this fails, we can try it without the reveal.
204
- try_equal_with_param_env ( self . param_env )
195
+ if equal_up_to_regions ( self . tcx , param_env, src, dest) {
196
+ return true ;
205
197
}
198
+
199
+ // If this fails, we can try it without the reveal.
200
+ equal_up_to_regions ( self . tcx , self . param_env , src, dest)
206
201
}
207
202
}
208
203
0 commit comments