@@ -8,7 +8,6 @@ use rustc_middle::mir::Constant;
8
8
use rustc_middle:: mir:: { Body , Location , Promoted } ;
9
9
use rustc_middle:: ty:: subst:: SubstsRef ;
10
10
use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
11
- #[ cfg( debug_assertions) ]
12
11
use rustc_span:: { Span , Symbol } ;
13
12
14
13
/// Replaces all free regions appearing in the MIR with fresh
@@ -32,21 +31,6 @@ pub fn renumber_mir<'tcx>(
32
31
33
32
/// Replaces all regions appearing in `value` with fresh inference
34
33
/// 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) ]
50
34
#[ instrument( skip( infcx) , level = "debug" ) ]
51
35
pub ( crate ) fn renumber_regions < ' tcx , T > (
52
36
infcx : & BorrowckInferCtxt < ' _ , ' tcx > ,
@@ -62,14 +46,12 @@ where
62
46
} )
63
47
}
64
48
65
- #[ cfg( debug_assertions) ]
66
49
#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash ) ]
67
50
pub ( crate ) enum BoundRegionInfo {
68
51
Name ( Symbol ) ,
69
52
Span ( Span ) ,
70
53
}
71
54
72
- #[ cfg( debug_assertions) ]
73
55
#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash ) ]
74
56
pub ( crate ) enum RegionCtxt {
75
57
Location ( Location ) ,
@@ -82,12 +64,11 @@ pub(crate) enum RegionCtxt {
82
64
Unknown ,
83
65
}
84
66
85
- #[ cfg( debug_assertions) ]
86
67
impl RegionCtxt {
87
68
/// Used to determine the representative of a component in the strongly connected
88
69
/// constraint graph
89
70
/// 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 {
91
72
let _anon = Symbol :: intern ( "anon" ) ;
92
73
93
74
match self {
@@ -106,70 +87,33 @@ struct NllVisitor<'a, 'tcx> {
106
87
}
107
88
108
89
impl < ' a , ' tcx > NllVisitor < ' a , ' tcx > {
109
- #[ cfg( debug_assertions) ]
110
90
fn renumber_regions < T > ( & mut self , value : T , ctxt : RegionCtxt ) -> T
111
91
where
112
92
T : TypeFoldable < ' tcx > ,
113
93
{
114
94
renumber_regions ( self . infcx , value, ctxt)
115
95
}
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
- }
124
96
}
125
97
126
98
impl < ' a , ' tcx > MutVisitor < ' tcx > for NllVisitor < ' a , ' tcx > {
127
99
fn tcx ( & self ) -> TyCtxt < ' tcx > {
128
100
self . infcx . tcx
129
101
}
130
102
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) ]
140
103
#[ instrument( skip( self ) , level = "debug" ) ]
141
104
fn visit_ty ( & mut self , ty : & mut Ty < ' tcx > , _ty_context : TyContext ) {
142
105
* ty = self . renumber_regions ( * ty, RegionCtxt :: TyContext ( _ty_context) ) ;
143
106
144
107
debug ! ( ?ty) ;
145
108
}
146
109
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) ]
156
110
#[ instrument( skip( self ) , level = "debug" ) ]
157
111
fn visit_substs ( & mut self , substs : & mut SubstsRef < ' tcx > , location : Location ) {
158
112
* substs = self . renumber_regions ( * substs, RegionCtxt :: Location ( location) ) ;
159
113
160
114
debug ! ( ?substs) ;
161
115
}
162
116
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) ]
173
117
#[ instrument( skip( self ) , level = "debug" ) ]
174
118
fn visit_region ( & mut self , region : & mut ty:: Region < ' tcx > , location : Location ) {
175
119
let old_region = * region;
@@ -178,15 +122,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
178
122
debug ! ( ?region) ;
179
123
}
180
124
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) ]
190
125
#[ instrument( skip( self ) , level = "debug" ) ]
191
126
fn visit_constant ( & mut self , constant : & mut Constant < ' tcx > , _location : Location ) {
192
127
let literal = constant. literal ;
0 commit comments