@@ -8,9 +8,7 @@ use rustc_middle::mir::{Body, ConstraintCategory};
88use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable , Unnormalized , Upcast } ;
99use rustc_span:: Span ;
1010use rustc_span:: def_id:: DefId ;
11- use rustc_trait_selection:: solve:: NoSolution ;
1211use rustc_trait_selection:: traits:: ObligationCause ;
13- use rustc_trait_selection:: traits:: query:: type_op:: custom:: CustomTypeOp ;
1412use rustc_trait_selection:: traits:: query:: type_op:: { self , TypeOpOutput } ;
1513use tracing:: { debug, instrument} ;
1614
@@ -242,71 +240,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
242240 body. source . def_id ( ) . expect_local ( ) ,
243241 ) ;
244242
245- if self . infcx . next_trait_solver ( ) {
246- let param_env = self . infcx . param_env ;
247- // FIXME: Make this into a real type op?
248- self . fully_perform_op (
249- location. to_locations ( ) ,
250- ConstraintCategory :: Boring ,
251- CustomTypeOp :: new (
252- |ocx| {
253- let structurally_normalize = |ty| {
254- ocx. structurally_normalize_ty ( & cause, param_env, Unnormalized :: new_wip ( ty) )
255- . unwrap_or_else ( |_| bug ! ( "struct tail should have been computable, since we computed it in HIR" ) )
256- } ;
257-
258- let tail = tcx. struct_tail_raw (
259- ty,
260- & cause,
261- structurally_normalize,
262- || { } ,
263- ) ;
264-
265- Ok ( tail)
266- } ,
267- "normalizing struct tail" ,
268- ) ,
269- )
270- . unwrap_or_else ( |guar| Ty :: new_error ( tcx, guar) )
271- } else {
272- let mut normalize = |ty| self . normalize ( ty, location) ;
273- let tail = tcx. struct_tail_raw ( ty, & cause, & mut normalize, || { } ) ;
274- normalize ( tail)
275- }
276- }
277-
278- #[ instrument( skip( self ) , level = "debug" ) ]
279- pub ( super ) fn structurally_resolve (
280- & mut self ,
281- ty : Ty < ' tcx > ,
282- location : impl NormalizeLocation ,
283- ) -> Ty < ' tcx > {
284- if self . infcx . next_trait_solver ( ) {
285- let body = self . body ;
286- let param_env = self . infcx . param_env ;
287- // FIXME: Make this into a real type op?
288- self . fully_perform_op (
289- location. to_locations ( ) ,
290- ConstraintCategory :: Boring ,
291- CustomTypeOp :: new (
292- |ocx| {
293- ocx. structurally_normalize_ty (
294- & ObligationCause :: misc (
295- location. to_locations ( ) . span ( body) ,
296- body. source . def_id ( ) . expect_local ( ) ,
297- ) ,
298- param_env,
299- Unnormalized :: new_wip ( ty) ,
300- )
301- . map_err ( |_| NoSolution )
302- } ,
303- "normalizing struct tail" ,
304- ) ,
305- )
306- . unwrap_or_else ( |guar| Ty :: new_error ( self . tcx ( ) , guar) )
307- } else {
308- self . normalize ( ty, location)
309- }
243+ let mut normalize = |ty| self . normalize ( ty, location) ;
244+ let tail = tcx. struct_tail_raw ( ty, & cause, & mut normalize, || { } ) ;
245+ normalize ( tail)
310246 }
311247
312248 #[ instrument( skip( self ) , level = "debug" ) ]
0 commit comments