@@ -333,9 +333,6 @@ pub struct InferCtxt<'tcx> {
333333 /// bound.
334334 universe : Cell < ty:: UniverseIndex > ,
335335
336- normalize_fn_sig_for_diagnostic :
337- Option < Lrc < dyn Fn ( & InferCtxt < ' tcx > , ty:: PolyFnSig < ' tcx > ) -> ty:: PolyFnSig < ' tcx > > > ,
338-
339336 /// During coherence we have to assume that other crates may add
340337 /// additional impls which we currently don't know about.
341338 ///
@@ -572,8 +569,6 @@ pub struct InferCtxtBuilder<'tcx> {
572569 considering_regions : bool ,
573570 /// Whether we are in coherence mode.
574571 intercrate : bool ,
575- normalize_fn_sig_for_diagnostic :
576- Option < Lrc < dyn Fn ( & InferCtxt < ' tcx > , ty:: PolyFnSig < ' tcx > ) -> ty:: PolyFnSig < ' tcx > > > ,
577572}
578573
579574pub trait TyCtxtInferExt < ' tcx > {
@@ -586,7 +581,6 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
586581 tcx : self ,
587582 defining_use_anchor : DefiningAnchor :: Error ,
588583 considering_regions : true ,
589- normalize_fn_sig_for_diagnostic : None ,
590584 intercrate : false ,
591585 }
592586 }
@@ -614,14 +608,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
614608 self
615609 }
616610
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-
625611 /// Given a canonical value `C` as a starting point, create an
626612 /// inference context that contains each of the bound values
627613 /// within instantiated as a fresh variable. The `f` closure is
@@ -643,13 +629,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
643629 }
644630
645631 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 ;
653633 InferCtxt {
654634 tcx,
655635 defining_use_anchor,
@@ -665,9 +645,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
665645 in_snapshot : Cell :: new ( false ) ,
666646 skip_leak_check : Cell :: new ( false ) ,
667647 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 ( ) ) ,
671648 intercrate,
672649 }
673650 }
@@ -708,7 +685,12 @@ impl<'tcx> InferCtxt<'tcx> {
708685 /// Creates a `TypeErrCtxt` for emitting various inference errors.
709686 /// During typeck, use `FnCtxt::err_ctxt` instead.
710687 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+ }
712694 }
713695
714696 pub fn is_in_snapshot ( & self ) -> bool {
0 commit comments