@@ -94,7 +94,7 @@ impl fmt::Display for Mode {
94
94
}
95
95
}
96
96
97
- struct Qualifier < ' a , ' gcx : ' a +' tcx , ' tcx : ' a > {
97
+ struct Checker < ' a , ' gcx : ' a +' tcx , ' tcx : ' a > {
98
98
mode : Mode ,
99
99
span : Span ,
100
100
def_id : DefId ,
@@ -117,12 +117,12 @@ macro_rules! unleash_miri {
117
117
} }
118
118
}
119
119
120
- impl < ' a , ' tcx > Qualifier < ' a , ' tcx , ' tcx > {
120
+ impl < ' a , ' tcx > Checker < ' a , ' tcx , ' tcx > {
121
121
fn new ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
122
122
def_id : DefId ,
123
123
mir : & ' a Mir < ' tcx > ,
124
124
mode : Mode )
125
- -> Qualifier < ' a , ' tcx , ' tcx > {
125
+ -> Checker < ' a , ' tcx , ' tcx > {
126
126
assert ! ( def_id. is_local( ) ) ;
127
127
let mut rpo = traversal:: reverse_postorder ( mir) ;
128
128
let temps = promote_consts:: collect_temps ( mir, & mut rpo) ;
@@ -137,7 +137,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
137
137
local_qualif[ arg] = Some ( qualif) ;
138
138
}
139
139
140
- Qualifier {
140
+ Checker {
141
141
mode,
142
142
span : mir. span ,
143
143
def_id,
@@ -265,8 +265,8 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
265
265
}
266
266
267
267
/// Qualify a whole const, static initializer or const fn.
268
- fn qualify_const ( & mut self ) -> ( Qualif , Lrc < BitSet < Local > > ) {
269
- debug ! ( "qualifying {} {:?}" , self . mode, self . def_id) ;
268
+ fn check_const ( & mut self ) -> ( Qualif , Lrc < BitSet < Local > > ) {
269
+ debug ! ( "const-checking {} {:?}" , self . mode, self . def_id) ;
270
270
271
271
let mir = self . mir ;
272
272
@@ -358,7 +358,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
358
358
/// Accumulates an Rvalue or Call's effects in self.qualif.
359
359
/// For functions (constant or not), it also records
360
360
/// candidates for promotion in promotion_candidates.
361
- impl < ' a , ' tcx > Visitor < ' tcx > for Qualifier < ' a , ' tcx , ' tcx > {
361
+ impl < ' a , ' tcx > Visitor < ' tcx > for Checker < ' a , ' tcx , ' tcx > {
362
362
fn visit_local ( & mut self ,
363
363
& local: & Local ,
364
364
_: PlaceContext < ' tcx > ,
@@ -1151,8 +1151,8 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1151
1151
return ( Qualif :: NOT_CONST . bits ( ) , Lrc :: new ( BitSet :: new_empty ( 0 ) ) ) ;
1152
1152
}
1153
1153
1154
- let mut qualifier = Qualifier :: new ( tcx, def_id, mir, Mode :: Const ) ;
1155
- let ( qualif, promoted_temps) = qualifier . qualify_const ( ) ;
1154
+ let mut checker = Checker :: new ( tcx, def_id, mir, Mode :: Const ) ;
1155
+ let ( qualif, promoted_temps) = checker . check_const ( ) ;
1156
1156
( qualif. bits ( ) , promoted_temps)
1157
1157
}
1158
1158
@@ -1195,13 +1195,13 @@ impl MirPass for QualifyAndPromoteConstants {
1195
1195
1196
1196
debug ! ( "run_pass: mode={:?}" , mode) ;
1197
1197
if mode == Mode :: Fn || mode == Mode :: ConstFn {
1198
- // This is ugly because Qualifier holds onto mir,
1198
+ // This is ugly because Checker holds onto mir,
1199
1199
// which can't be mutated until its scope ends.
1200
1200
let ( temps, candidates) = {
1201
- let mut qualifier = Qualifier :: new ( tcx, def_id, mir, mode) ;
1201
+ let mut checker = Checker :: new ( tcx, def_id, mir, mode) ;
1202
1202
if mode == Mode :: ConstFn {
1203
1203
if tcx. sess . opts . debugging_opts . unleash_the_miri_inside_of_you {
1204
- qualifier . qualify_const ( ) ;
1204
+ checker . check_const ( ) ;
1205
1205
} else if tcx. is_min_const_fn ( def_id) {
1206
1206
// enforce `min_const_fn` for stable const fns
1207
1207
use super :: qualify_min_const_fn:: is_min_const_fn;
@@ -1210,19 +1210,19 @@ impl MirPass for QualifyAndPromoteConstants {
1210
1210
} else {
1211
1211
// this should not produce any errors, but better safe than sorry
1212
1212
// FIXME(#53819)
1213
- qualifier . qualify_const ( ) ;
1213
+ checker . check_const ( ) ;
1214
1214
}
1215
1215
} else {
1216
1216
// Enforce a constant-like CFG for `const fn`.
1217
- qualifier . qualify_const ( ) ;
1217
+ checker . check_const ( ) ;
1218
1218
}
1219
1219
} else {
1220
- while let Some ( ( bb, data) ) = qualifier . rpo . next ( ) {
1221
- qualifier . visit_basic_block_data ( bb, data) ;
1220
+ while let Some ( ( bb, data) ) = checker . rpo . next ( ) {
1221
+ checker . visit_basic_block_data ( bb, data) ;
1222
1222
}
1223
1223
}
1224
1224
1225
- ( qualifier . temp_promotion_state , qualifier . promotion_candidates )
1225
+ ( checker . temp_promotion_state , checker . promotion_candidates )
1226
1226
} ;
1227
1227
1228
1228
// Do the actual promotion, now that we know what's viable.
@@ -1263,7 +1263,7 @@ impl MirPass for QualifyAndPromoteConstants {
1263
1263
// Already computed by `mir_const_qualif`.
1264
1264
const_promoted_temps. unwrap ( )
1265
1265
} else {
1266
- Qualifier :: new ( tcx, def_id, mir, mode) . qualify_const ( ) . 1
1266
+ Checker :: new ( tcx, def_id, mir, mode) . check_const ( ) . 1
1267
1267
} ;
1268
1268
1269
1269
// In `const` and `static` everything without `StorageDead`
0 commit comments