@@ -334,9 +334,6 @@ pub struct InferCtxt<'tcx> {
334
334
/// bound.
335
335
universe : Cell < ty:: UniverseIndex > ,
336
336
337
- normalize_fn_sig_for_diagnostic :
338
- Option < Lrc < dyn Fn ( & InferCtxt < ' tcx > , ty:: PolyFnSig < ' tcx > ) -> ty:: PolyFnSig < ' tcx > > > ,
339
-
340
337
/// During coherence we have to assume that other crates may add
341
338
/// additional impls which we currently don't know about.
342
339
///
@@ -573,8 +570,6 @@ pub struct InferCtxtBuilder<'tcx> {
573
570
considering_regions : bool ,
574
571
/// Whether we are in coherence mode.
575
572
intercrate : bool ,
576
- normalize_fn_sig_for_diagnostic :
577
- Option < Lrc < dyn Fn ( & InferCtxt < ' tcx > , ty:: PolyFnSig < ' tcx > ) -> ty:: PolyFnSig < ' tcx > > > ,
578
573
}
579
574
580
575
pub trait TyCtxtInferExt < ' tcx > {
@@ -587,7 +582,6 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
587
582
tcx : self ,
588
583
defining_use_anchor : DefiningAnchor :: Error ,
589
584
considering_regions : true ,
590
- normalize_fn_sig_for_diagnostic : None ,
591
585
intercrate : false ,
592
586
}
593
587
}
@@ -615,14 +609,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
615
609
self
616
610
}
617
611
618
- pub fn with_normalize_fn_sig_for_diagnostic (
619
- mut self ,
620
- fun : Lrc < dyn Fn ( & InferCtxt < ' tcx > , ty:: PolyFnSig < ' tcx > ) -> ty:: PolyFnSig < ' tcx > > ,
621
- ) -> Self {
622
- self . normalize_fn_sig_for_diagnostic = Some ( fun) ;
623
- self
624
- }
625
-
626
612
/// Given a canonical value `C` as a starting point, create an
627
613
/// inference context that contains each of the bound values
628
614
/// within instantiated as a fresh variable. The `f` closure is
@@ -644,13 +630,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
644
630
}
645
631
646
632
pub fn build ( & mut self ) -> InferCtxt < ' tcx > {
647
- let InferCtxtBuilder {
648
- tcx,
649
- defining_use_anchor,
650
- considering_regions,
651
- ref normalize_fn_sig_for_diagnostic,
652
- intercrate,
653
- } = * self ;
633
+ let InferCtxtBuilder { tcx, defining_use_anchor, considering_regions, intercrate } = * self ;
654
634
InferCtxt {
655
635
tcx,
656
636
defining_use_anchor,
@@ -666,9 +646,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
666
646
in_snapshot : Cell :: new ( false ) ,
667
647
skip_leak_check : Cell :: new ( false ) ,
668
648
universe : Cell :: new ( ty:: UniverseIndex :: ROOT ) ,
669
- normalize_fn_sig_for_diagnostic : normalize_fn_sig_for_diagnostic
670
- . as_ref ( )
671
- . map ( |f| f. clone ( ) ) ,
672
649
intercrate,
673
650
}
674
651
}
@@ -709,7 +686,12 @@ impl<'tcx> InferCtxt<'tcx> {
709
686
/// Creates a `TypeErrCtxt` for emitting various inference errors.
710
687
/// During typeck, use `FnCtxt::err_ctxt` instead.
711
688
pub fn err_ctxt ( & self ) -> TypeErrCtxt < ' _ , ' tcx > {
712
- TypeErrCtxt { infcx : self , typeck_results : None , fallback_has_occurred : false }
689
+ TypeErrCtxt {
690
+ infcx : self ,
691
+ typeck_results : None ,
692
+ fallback_has_occurred : false ,
693
+ normalize_fn_sig : Box :: new ( |fn_sig| fn_sig) ,
694
+ }
713
695
}
714
696
715
697
pub fn is_in_snapshot ( & self ) -> bool {
0 commit comments