@@ -89,20 +89,21 @@ pub fn equal_up_to_regions<'tcx>(
89
89
90
90
// Normalize lifetimes away on both sides, then compare.
91
91
let normalize = |ty : Ty < ' tcx > | {
92
- let ty = ty. fold_with ( & mut BottomUpFolder {
93
- tcx,
94
- // FIXME: We erase all late-bound lifetimes, but this is not fully correct.
95
- // If you have a type like `<for<'a> fn(&'a u32) as SomeTrait>::Assoc`,
96
- // this is not necessarily equivalent to `<fn(&'static u32) as SomeTrait>::Assoc`,
97
- // since one may have an `impl SomeTrait for fn(&32)` and
98
- // `impl SomeTrait for fn(&'static u32)` at the same time which
99
- // specify distinct values for Assoc. (See also #56105)
100
- lt_op : |_| tcx. lifetimes . re_erased ,
101
- // Leave consts and types unchanged.
102
- ct_op : |ct| ct,
103
- ty_op : |ty| ty,
104
- } ) ;
105
- tcx. try_normalize_erasing_regions ( param_env, ty) . unwrap_or ( ty)
92
+ tcx. try_normalize_erasing_regions ( param_env, ty) . unwrap_or ( ty) . fold_with (
93
+ & mut BottomUpFolder {
94
+ tcx,
95
+ // FIXME: We erase all late-bound lifetimes, but this is not fully correct.
96
+ // If you have a type like `<for<'a> fn(&'a u32) as SomeTrait>::Assoc`,
97
+ // this is not necessarily equivalent to `<fn(&'static u32) as SomeTrait>::Assoc`,
98
+ // since one may have an `impl SomeTrait for fn(&32)` and
99
+ // `impl SomeTrait for fn(&'static u32)` at the same time which
100
+ // specify distinct values for Assoc. (See also #56105)
101
+ lt_op : |_| tcx. lifetimes . re_erased ,
102
+ // Leave consts and types unchanged.
103
+ ct_op : |ct| ct,
104
+ ty_op : |ty| ty,
105
+ } ,
106
+ )
106
107
} ;
107
108
tcx. infer_ctxt ( ) . enter ( |infcx| infcx. can_eq ( param_env, normalize ( src) , normalize ( dest) ) . is_ok ( ) )
108
109
}
0 commit comments