Skip to content

Commit a5e4d1a

Browse files
committed
rustc_mir: rename qualify_consts::Qualifier to Checker.
1 parent c67d474 commit a5e4d1a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl fmt::Display for Mode {
9494
}
9595
}
9696

97-
struct Qualifier<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
97+
struct Checker<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
9898
mode: Mode,
9999
span: Span,
100100
def_id: DefId,
@@ -117,12 +117,12 @@ macro_rules! unleash_miri {
117117
}}
118118
}
119119

120-
impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
120+
impl<'a, 'tcx> Checker<'a, 'tcx, 'tcx> {
121121
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
122122
def_id: DefId,
123123
mir: &'a Mir<'tcx>,
124124
mode: Mode)
125-
-> Qualifier<'a, 'tcx, 'tcx> {
125+
-> Checker<'a, 'tcx, 'tcx> {
126126
assert!(def_id.is_local());
127127
let mut rpo = traversal::reverse_postorder(mir);
128128
let temps = promote_consts::collect_temps(mir, &mut rpo);
@@ -137,7 +137,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
137137
local_qualif[arg] = Some(qualif);
138138
}
139139

140-
Qualifier {
140+
Checker {
141141
mode,
142142
span: mir.span,
143143
def_id,
@@ -265,8 +265,8 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
265265
}
266266

267267
/// 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);
270270

271271
let mir = self.mir;
272272

@@ -358,7 +358,7 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
358358
/// Accumulates an Rvalue or Call's effects in self.qualif.
359359
/// For functions (constant or not), it also records
360360
/// 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> {
362362
fn visit_local(&mut self,
363363
&local: &Local,
364364
_: PlaceContext<'tcx>,
@@ -1151,8 +1151,8 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11511151
return (Qualif::NOT_CONST.bits(), Lrc::new(BitSet::new_empty(0)));
11521152
}
11531153

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();
11561156
(qualif.bits(), promoted_temps)
11571157
}
11581158

@@ -1195,13 +1195,13 @@ impl MirPass for QualifyAndPromoteConstants {
11951195

11961196
debug!("run_pass: mode={:?}", mode);
11971197
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,
11991199
// which can't be mutated until its scope ends.
12001200
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);
12021202
if mode == Mode::ConstFn {
12031203
if tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
1204-
qualifier.qualify_const();
1204+
checker.check_const();
12051205
} else if tcx.is_min_const_fn(def_id) {
12061206
// enforce `min_const_fn` for stable const fns
12071207
use super::qualify_min_const_fn::is_min_const_fn;
@@ -1210,19 +1210,19 @@ impl MirPass for QualifyAndPromoteConstants {
12101210
} else {
12111211
// this should not produce any errors, but better safe than sorry
12121212
// FIXME(#53819)
1213-
qualifier.qualify_const();
1213+
checker.check_const();
12141214
}
12151215
} else {
12161216
// Enforce a constant-like CFG for `const fn`.
1217-
qualifier.qualify_const();
1217+
checker.check_const();
12181218
}
12191219
} 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);
12221222
}
12231223
}
12241224

1225-
(qualifier.temp_promotion_state, qualifier.promotion_candidates)
1225+
(checker.temp_promotion_state, checker.promotion_candidates)
12261226
};
12271227

12281228
// Do the actual promotion, now that we know what's viable.
@@ -1263,7 +1263,7 @@ impl MirPass for QualifyAndPromoteConstants {
12631263
// Already computed by `mir_const_qualif`.
12641264
const_promoted_temps.unwrap()
12651265
} else {
1266-
Qualifier::new(tcx, def_id, mir, mode).qualify_const().1
1266+
Checker::new(tcx, def_id, mir, mode).check_const().1
12671267
};
12681268

12691269
// In `const` and `static` everything without `StorageDead`

0 commit comments

Comments
 (0)