@@ -171,14 +171,6 @@ impl<'tcx> TyCtxt<'tcx> {
171
171
}
172
172
}
173
173
174
- /// Attempts to returns the deeply last field of nested structures, but
175
- /// does not apply any normalization in its search. Returns the same type
176
- /// if input `ty` is not a structure at all.
177
- pub fn struct_tail_without_normalization ( self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
178
- let tcx = self ;
179
- tcx. struct_tail_with_normalize ( ty, |ty| ty, || { } )
180
- }
181
-
182
174
/// Returns the deeply last field of nested structures, or the same type if
183
175
/// not a structure at all. Corresponds to the only possible unsized field,
184
176
/// and its type can be used to determine unsizing strategy.
@@ -188,20 +180,22 @@ impl<'tcx> TyCtxt<'tcx> {
188
180
/// normalization attempt may cause compiler bugs.
189
181
pub fn struct_tail_for_codegen ( self , ty : Ty < ' tcx > , param_env : ty:: ParamEnv < ' tcx > ) -> Ty < ' tcx > {
190
182
let tcx = self ;
191
- tcx. struct_tail_with_normalize ( ty, |ty| tcx. normalize_erasing_regions ( param_env, ty) , || { } )
183
+ tcx. struct_tail_raw ( ty, |ty| tcx. normalize_erasing_regions ( param_env, ty) , || { } )
192
184
}
193
185
194
186
/// Returns the deeply last field of nested structures, or the same type if
195
187
/// not a structure at all. Corresponds to the only possible unsized field,
196
188
/// and its type can be used to determine unsizing strategy.
197
189
///
198
190
/// This is parameterized over the normalization strategy (i.e. how to
199
- /// handle `<T as Trait>::Assoc` and `impl Trait`); pass the identity
200
- /// function to indicate no normalization should take place.
191
+ /// handle `<T as Trait>::Assoc` and `impl Trait`). You almost certainly do
192
+ /// **NOT** want to pass the identity function here, unless you know what
193
+ /// you're doing, or you're within normalization code itself and will handle
194
+ /// an unnormalized tail recursively.
201
195
///
202
196
/// See also `struct_tail_for_codegen`, which is suitable for use
203
197
/// during codegen.
204
- pub fn struct_tail_with_normalize (
198
+ pub fn struct_tail_raw (
205
199
self ,
206
200
mut ty : Ty < ' tcx > ,
207
201
mut normalize : impl FnMut ( Ty < ' tcx > ) -> Ty < ' tcx > ,
@@ -281,7 +275,7 @@ impl<'tcx> TyCtxt<'tcx> {
281
275
param_env : ty:: ParamEnv < ' tcx > ,
282
276
) -> ( Ty < ' tcx > , Ty < ' tcx > ) {
283
277
let tcx = self ;
284
- tcx. struct_lockstep_tails_with_normalize ( source, target, |ty| {
278
+ tcx. struct_lockstep_tails_raw ( source, target, |ty| {
285
279
tcx. normalize_erasing_regions ( param_env, ty)
286
280
} )
287
281
}
@@ -294,7 +288,7 @@ impl<'tcx> TyCtxt<'tcx> {
294
288
///
295
289
/// See also `struct_lockstep_tails_for_codegen`, which is suitable for use
296
290
/// during codegen.
297
- pub fn struct_lockstep_tails_with_normalize (
291
+ pub fn struct_lockstep_tails_raw (
298
292
self ,
299
293
source : Ty < ' tcx > ,
300
294
target : Ty < ' tcx > ,
0 commit comments