@@ -88,23 +88,32 @@ struct NormalizeAfterErasingRegionsFolder<'tcx> {
88
88
param_env : ty:: ParamEnv < ' tcx > ,
89
89
}
90
90
91
+ impl < ' tcx > NormalizeAfterErasingRegionsFolder < ' tcx > {
92
+ fn normalize_generic_arg_after_erasing_regions (
93
+ & self ,
94
+ arg : ty:: GenericArg < ' tcx > ,
95
+ ) -> ty:: GenericArg < ' tcx > {
96
+ let arg = self . param_env . and ( arg) ;
97
+ self . tcx . normalize_generic_arg_after_erasing_regions ( arg)
98
+ }
99
+ }
100
+
91
101
impl TypeFolder < ' tcx > for NormalizeAfterErasingRegionsFolder < ' tcx > {
92
102
fn tcx ( & self ) -> TyCtxt < ' tcx > {
93
103
self . tcx
94
104
}
95
105
96
106
fn fold_ty ( & mut self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
97
- let arg = self . param_env . and ( ty. into ( ) ) ;
98
- self . tcx . normalize_generic_arg_after_erasing_regions ( arg) . expect_ty ( )
107
+ self . normalize_generic_arg_after_erasing_regions ( ty. into ( ) ) . expect_ty ( )
99
108
}
100
109
101
110
fn fold_const ( & mut self , c : & ' tcx ty:: Const < ' tcx > ) -> & ' tcx ty:: Const < ' tcx > {
102
- let arg = self . param_env . and ( c. into ( ) ) ;
103
- self . tcx . normalize_generic_arg_after_erasing_regions ( arg) . expect_const ( )
111
+ self . normalize_generic_arg_after_erasing_regions ( c. into ( ) ) . expect_const ( )
104
112
}
105
113
106
114
#[ inline]
107
115
fn fold_mir_const ( & mut self , c : mir:: ConstantKind < ' tcx > ) -> mir:: ConstantKind < ' tcx > {
116
+ // FIXME: This *probalby* needs canonicalization too!
108
117
let arg = self . param_env . and ( c) ;
109
118
self . tcx . normalize_mir_const_after_erasing_regions ( arg)
110
119
}
0 commit comments