@@ -383,32 +383,6 @@ where
383
383
result
384
384
}
385
385
386
- #[ instrument( level = "info" , skip( selcx, param_env, cause, obligations) ) ]
387
- pub ( crate ) fn try_normalize_with_depth_to < ' a , ' b , ' tcx , T > (
388
- selcx : & ' a mut SelectionContext < ' b , ' tcx > ,
389
- param_env : ty:: ParamEnv < ' tcx > ,
390
- cause : ObligationCause < ' tcx > ,
391
- depth : usize ,
392
- value : T ,
393
- obligations : & mut Vec < PredicateObligation < ' tcx > > ,
394
- ) -> T
395
- where
396
- T : TypeFoldable < TyCtxt < ' tcx > > ,
397
- {
398
- debug ! ( obligations. len = obligations. len( ) ) ;
399
- let mut normalizer = AssocTypeNormalizer :: new_without_eager_inference_replacement (
400
- selcx,
401
- param_env,
402
- cause,
403
- depth,
404
- obligations,
405
- ) ;
406
- let result = ensure_sufficient_stack ( || normalizer. fold ( value) ) ;
407
- debug ! ( ?result, obligations. len = normalizer. obligations. len( ) ) ;
408
- debug ! ( ?normalizer. obligations, ) ;
409
- result
410
- }
411
-
412
386
pub ( crate ) fn needs_normalization < ' tcx , T : TypeVisitable < TyCtxt < ' tcx > > > (
413
387
value : & T ,
414
388
reveal : Reveal ,
@@ -435,10 +409,6 @@ struct AssocTypeNormalizer<'a, 'b, 'tcx> {
435
409
obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
436
410
depth : usize ,
437
411
universes : Vec < Option < ty:: UniverseIndex > > ,
438
- /// If true, when a projection is unable to be completed, an inference
439
- /// variable will be created and an obligation registered to project to that
440
- /// inference variable. Also, constants will be eagerly evaluated.
441
- eager_inference_replacement : bool ,
442
412
}
443
413
444
414
impl < ' a , ' b , ' tcx > AssocTypeNormalizer < ' a , ' b , ' tcx > {
@@ -450,33 +420,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
450
420
obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
451
421
) -> AssocTypeNormalizer < ' a , ' b , ' tcx > {
452
422
debug_assert ! ( !selcx. infcx. next_trait_solver( ) ) ;
453
- AssocTypeNormalizer {
454
- selcx,
455
- param_env,
456
- cause,
457
- obligations,
458
- depth,
459
- universes : vec ! [ ] ,
460
- eager_inference_replacement : true ,
461
- }
462
- }
463
-
464
- fn new_without_eager_inference_replacement (
465
- selcx : & ' a mut SelectionContext < ' b , ' tcx > ,
466
- param_env : ty:: ParamEnv < ' tcx > ,
467
- cause : ObligationCause < ' tcx > ,
468
- depth : usize ,
469
- obligations : & ' a mut Vec < PredicateObligation < ' tcx > > ,
470
- ) -> AssocTypeNormalizer < ' a , ' b , ' tcx > {
471
- AssocTypeNormalizer {
472
- selcx,
473
- param_env,
474
- cause,
475
- obligations,
476
- depth,
477
- universes : vec ! [ ] ,
478
- eager_inference_replacement : false ,
479
- }
423
+ AssocTypeNormalizer { selcx, param_env, cause, obligations, depth, universes : vec ! [ ] }
480
424
}
481
425
482
426
fn fold < T : TypeFoldable < TyCtxt < ' tcx > > > ( & mut self , value : T ) -> T {
@@ -579,28 +523,14 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
579
523
// register an obligation to *later* project, since we know
580
524
// there won't be bound vars there.
581
525
let data = data. fold_with ( self ) ;
582
- let normalized_ty = if self . eager_inference_replacement {
583
- normalize_projection_type (
584
- self . selcx ,
585
- self . param_env ,
586
- data,
587
- self . cause . clone ( ) ,
588
- self . depth ,
589
- self . obligations ,
590
- )
591
- } else {
592
- opt_normalize_projection_type (
593
- self . selcx ,
594
- self . param_env ,
595
- data,
596
- self . cause . clone ( ) ,
597
- self . depth ,
598
- self . obligations ,
599
- )
600
- . ok ( )
601
- . flatten ( )
602
- . unwrap_or_else ( || ty. super_fold_with ( self ) . into ( ) )
603
- } ;
526
+ let normalized_ty = normalize_projection_type (
527
+ self . selcx ,
528
+ self . param_env ,
529
+ data,
530
+ self . cause . clone ( ) ,
531
+ self . depth ,
532
+ self . obligations ,
533
+ ) ;
604
534
debug ! (
605
535
?self . depth,
606
536
?ty,
0 commit comments