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