@@ -39,7 +39,6 @@ use rustc_span::Span;
3939
4040use std:: cell:: { Cell , RefCell } ;
4141use std:: fmt;
42- use std:: ops:: Drop ;
4342
4443use self :: combine:: CombineFields ;
4544use self :: error_reporting:: TypeErrCtxt ;
@@ -342,11 +341,6 @@ pub struct InferCtxt<'tcx> {
342341 /// there is no type that the user could *actually name* that
343342 /// would satisfy it. This avoids crippling inference, basically.
344343 pub intercrate : bool ,
345-
346- /// Flag that is set when we enter canonicalization. Used for debugging to ensure
347- /// that we only collect region information for `BorrowckInferCtxt::reg_var_to_origin`
348- /// inside non-canonicalization contexts.
349- inside_canonicalization_ctxt : Cell < bool > ,
350344}
351345
352346/// See the `error_reporting` module for more details.
@@ -638,7 +632,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
638632 skip_leak_check : Cell :: new ( false ) ,
639633 universe : Cell :: new ( ty:: UniverseIndex :: ROOT ) ,
640634 intercrate,
641- inside_canonicalization_ctxt : Cell :: new ( false ) ,
642635 }
643636 }
644637}
@@ -1636,31 +1629,6 @@ impl<'tcx> InferCtxt<'tcx> {
16361629 }
16371630 }
16381631 }
1639-
1640- pub fn inside_canonicalization_ctxt ( & self ) -> bool {
1641- self . inside_canonicalization_ctxt . get ( )
1642- }
1643-
1644- pub fn set_canonicalization_ctxt ( & self ) -> CanonicalizationCtxtGuard < ' _ , ' tcx > {
1645- let prev_ctxt = self . inside_canonicalization_ctxt ( ) ;
1646- self . inside_canonicalization_ctxt . set ( true ) ;
1647- CanonicalizationCtxtGuard { prev_ctxt, infcx : self }
1648- }
1649-
1650- fn set_canonicalization_ctxt_to ( & self , ctxt : bool ) {
1651- self . inside_canonicalization_ctxt . set ( ctxt) ;
1652- }
1653- }
1654-
1655- pub struct CanonicalizationCtxtGuard < ' cx , ' tcx > {
1656- prev_ctxt : bool ,
1657- infcx : & ' cx InferCtxt < ' tcx > ,
1658- }
1659-
1660- impl < ' cx , ' tcx > Drop for CanonicalizationCtxtGuard < ' cx , ' tcx > {
1661- fn drop ( & mut self ) {
1662- self . infcx . set_canonicalization_ctxt_to ( self . prev_ctxt )
1663- }
16641632}
16651633
16661634impl < ' tcx > TypeErrCtxt < ' _ , ' tcx > {
0 commit comments