@@ -8,7 +8,6 @@ use rustc_middle::mir::Constant;
88use rustc_middle:: mir:: { Body , Location , Promoted } ;
99use rustc_middle:: ty:: subst:: SubstsRef ;
1010use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
11- #[ cfg( debug_assertions) ]
1211use rustc_span:: { Span , Symbol } ;
1312
1413/// Replaces all free regions appearing in the MIR with fresh
@@ -32,21 +31,6 @@ pub fn renumber_mir<'tcx>(
3231
3332/// Replaces all regions appearing in `value` with fresh inference
3433/// variables.
35- #[ cfg( not( debug_assertions) ) ]
36- #[ instrument( skip( infcx) , level = "debug" ) ]
37- pub ( crate ) fn renumber_regions < ' tcx , T > ( infcx : & BorrowckInferCtxt < ' _ , ' tcx > , value : T ) -> T
38- where
39- T : TypeFoldable < ' tcx > ,
40- {
41- infcx. tcx . fold_regions ( value, |_region, _depth| {
42- let origin = NllRegionVariableOrigin :: Existential { from_forall : false } ;
43- infcx. next_nll_region_var ( origin)
44- } )
45- }
46-
47- /// Replaces all regions appearing in `value` with fresh inference
48- /// variables.
49- #[ cfg( debug_assertions) ]
5034#[ instrument( skip( infcx) , level = "debug" ) ]
5135pub ( crate ) fn renumber_regions < ' tcx , T > (
5236 infcx : & BorrowckInferCtxt < ' _ , ' tcx > ,
@@ -62,14 +46,12 @@ where
6246 } )
6347}
6448
65- #[ cfg( debug_assertions) ]
6649#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash ) ]
6750pub ( crate ) enum BoundRegionInfo {
6851 Name ( Symbol ) ,
6952 Span ( Span ) ,
7053}
7154
72- #[ cfg( debug_assertions) ]
7355#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash ) ]
7456pub ( crate ) enum RegionCtxt {
7557 Location ( Location ) ,
@@ -82,12 +64,11 @@ pub(crate) enum RegionCtxt {
8264 Unknown ,
8365}
8466
85- #[ cfg( debug_assertions) ]
8667impl RegionCtxt {
8768 /// Used to determine the representative of a component in the strongly connected
8869 /// constraint graph
8970 /// FIXME: don't use underscore here. Got a 'not used' error for some reason
90- pub ( crate ) fn _preference_value ( self ) -> usize {
71+ pub ( crate ) fn preference_value ( self ) -> usize {
9172 let _anon = Symbol :: intern ( "anon" ) ;
9273
9374 match self {
@@ -106,70 +87,33 @@ struct NllVisitor<'a, 'tcx> {
10687}
10788
10889impl < ' a , ' tcx > NllVisitor < ' a , ' tcx > {
109- #[ cfg( debug_assertions) ]
11090 fn renumber_regions < T > ( & mut self , value : T , ctxt : RegionCtxt ) -> T
11191 where
11292 T : TypeFoldable < ' tcx > ,
11393 {
11494 renumber_regions ( self . infcx , value, ctxt)
11595 }
116-
117- #[ cfg( not( debug_assertions) ) ]
118- fn renumber_regions < T > ( & mut self , value : T ) -> T
119- where
120- T : TypeFoldable < ' tcx > ,
121- {
122- renumber_regions ( self . infcx , value)
123- }
12496}
12597
12698impl < ' a , ' tcx > MutVisitor < ' tcx > for NllVisitor < ' a , ' tcx > {
12799 fn tcx ( & self ) -> TyCtxt < ' tcx > {
128100 self . infcx . tcx
129101 }
130102
131- #[ cfg( not( debug_assertions) ) ]
132- #[ instrument( skip( self ) , level = "debug" ) ]
133- fn visit_ty ( & mut self , ty : & mut Ty < ' tcx > , _ty_context : TyContext ) {
134- * ty = self . renumber_regions ( * ty) ;
135-
136- debug ! ( ?ty) ;
137- }
138-
139- #[ cfg( debug_assertions) ]
140103 #[ instrument( skip( self ) , level = "debug" ) ]
141104 fn visit_ty ( & mut self , ty : & mut Ty < ' tcx > , _ty_context : TyContext ) {
142105 * ty = self . renumber_regions ( * ty, RegionCtxt :: TyContext ( _ty_context) ) ;
143106
144107 debug ! ( ?ty) ;
145108 }
146109
147- #[ cfg( not( debug_assertions) ) ]
148- #[ instrument( skip( self ) , level = "debug" ) ]
149- fn visit_substs ( & mut self , substs : & mut SubstsRef < ' tcx > , location : Location ) {
150- * substs = self . renumber_regions ( * substs) ;
151-
152- debug ! ( ?substs) ;
153- }
154-
155- #[ cfg( debug_assertions) ]
156110 #[ instrument( skip( self ) , level = "debug" ) ]
157111 fn visit_substs ( & mut self , substs : & mut SubstsRef < ' tcx > , location : Location ) {
158112 * substs = self . renumber_regions ( * substs, RegionCtxt :: Location ( location) ) ;
159113
160114 debug ! ( ?substs) ;
161115 }
162116
163- #[ cfg( not( debug_assertions) ) ]
164- #[ instrument( skip( self ) , level = "debug" ) ]
165- fn visit_region ( & mut self , region : & mut ty:: Region < ' tcx > , location : Location ) {
166- let old_region = * region;
167- * region = self . renumber_regions ( old_region) ;
168-
169- debug ! ( ?region) ;
170- }
171-
172- #[ cfg( debug_assertions) ]
173117 #[ instrument( skip( self ) , level = "debug" ) ]
174118 fn visit_region ( & mut self , region : & mut ty:: Region < ' tcx > , location : Location ) {
175119 let old_region = * region;
@@ -178,15 +122,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
178122 debug ! ( ?region) ;
179123 }
180124
181- #[ cfg( not( debug_assertions) ) ]
182- #[ instrument( skip( self ) , level = "debug" ) ]
183- fn visit_constant ( & mut self , constant : & mut Constant < ' tcx > , _location : Location ) {
184- let literal = constant. literal ;
185- constant. literal = self . renumber_regions ( literal) ;
186- debug ! ( "constant: {:#?}" , constant) ;
187- }
188-
189- #[ cfg( debug_assertions) ]
190125 #[ instrument( skip( self ) , level = "debug" ) ]
191126 fn visit_constant ( & mut self , constant : & mut Constant < ' tcx > , _location : Location ) {
192127 let literal = constant. literal ;
0 commit comments