@@ -374,32 +374,6 @@ where
374
374
result
375
375
}
376
376
377
- #[ instrument( level = "info" , skip( selcx, param_env, cause, obligations) ) ]
378
- pub ( crate ) fn try_normalize_with_depth_to < ' a , ' b , ' tcx , T > (
379
- selcx : & ' a mut SelectionContext < ' b , ' tcx > ,
380
- param_env : ty:: ParamEnv < ' tcx > ,
381
- cause : ObligationCause < ' tcx > ,
382
- depth : usize ,
383
- value : T ,
384
- obligations : & mut Vec < PredicateObligation < ' tcx > > ,
385
- ) -> T
386
- where
387
- T : TypeFoldable < TyCtxt < ' tcx > > ,
388
- {
389
- debug ! ( obligations. len = obligations. len( ) ) ;
390
- let mut normalizer = AssocTypeNormalizer :: new_without_eager_inference_replacement (
391
- selcx,
392
- param_env,
393
- cause,
394
- depth,
395
- obligations,
396
- ) ;
397
- let result = ensure_sufficient_stack ( || normalizer. fold ( value) ) ;
398
- debug ! ( ?result, obligations. len = normalizer. obligations. len( ) ) ;
399
- debug ! ( ?normalizer. obligations, ) ;
400
- result
401
- }
402
-
403
377
pub ( crate ) fn needs_normalization < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > > (
404
378
value : & T ,
405
379
reveal : Reveal ,
@@ -426,10 +400,6 @@ struct AssocTypeNormalizer<'a, 'b, 'tcx> {
426
400
obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
427
401
depth : usize ,
428
402
universes : Vec < Option < ty:: UniverseIndex > > ,
429
- /// If true, when a projection is unable to be completed, an inference
430
- /// variable will be created and an obligation registered to project to that
431
- /// inference variable. Also, constants will be eagerly evaluated.
432
- eager_inference_replacement : bool ,
433
403
}
434
404
435
405
impl < ' a , ' b , ' tcx > AssocTypeNormalizer < ' a , ' b , ' tcx > {
@@ -441,33 +411,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
441
411
obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
442
412
) -> AssocTypeNormalizer < ' a , ' b , ' tcx > {
443
413
debug_assert ! ( !selcx. infcx. next_trait_solver( ) ) ;
444
- AssocTypeNormalizer {
445
- selcx,
446
- param_env,
447
- cause,
448
- obligations,
449
- depth,
450
- universes : vec ! [ ] ,
451
- eager_inference_replacement : true ,
452
- }
453
- }
454
-
455
- fn new_without_eager_inference_replacement (
456
- selcx : & ' a mut SelectionContext < ' b , ' tcx > ,
457
- param_env : ty:: ParamEnv < ' tcx > ,
458
- cause : ObligationCause < ' tcx > ,
459
- depth : usize ,
460
- obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
461
- ) -> AssocTypeNormalizer < ' a , ' b , ' tcx > {
462
- AssocTypeNormalizer {
463
- selcx,
464
- param_env,
465
- cause,
466
- obligations,
467
- depth,
468
- universes : vec ! [ ] ,
469
- eager_inference_replacement : false ,
470
- }
414
+ AssocTypeNormalizer { selcx, param_env, cause, obligations, depth, universes : vec ! [ ] }
471
415
}
472
416
473
417
fn fold < T : TypeFoldable < TyCtxt < ' tcx > > > ( & mut self , value : T ) -> T {
@@ -570,28 +514,14 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
570
514
// register an obligation to *later* project, since we know
571
515
// there won't be bound vars there.
572
516
let data = data. fold_with ( self ) ;
573
- let normalized_ty = if self . eager_inference_replacement {
574
- normalize_projection_type (
575
- self . selcx ,
576
- self . param_env ,
577
- data,
578
- self . cause . clone ( ) ,
579
- self . depth ,
580
- self . obligations ,
581
- )
582
- } else {
583
- opt_normalize_projection_type (
584
- self . selcx ,
585
- self . param_env ,
586
- data,
587
- self . cause . clone ( ) ,
588
- self . depth ,
589
- self . obligations ,
590
- )
591
- . ok ( )
592
- . flatten ( )
593
- . unwrap_or_else ( || ty. super_fold_with ( self ) . into ( ) )
594
- } ;
517
+ let normalized_ty = normalize_projection_type (
518
+ self . selcx ,
519
+ self . param_env ,
520
+ data,
521
+ self . cause . clone ( ) ,
522
+ self . depth ,
523
+ self . obligations ,
524
+ ) ;
595
525
debug ! (
596
526
?self . depth,
597
527
?ty,
0 commit comments