Skip to content

Commit 119fbd3

Browse files
committed
Improve terminology in elaborate_drops.rs.
It uses `MaybeInitializedPlaces` and `MaybeUninitializedPlaces`, but calls the results `live` and `dead`. This is very confusing given that there are also analyses called `MaybeLiveLocals` and `MaybeStorageLive` and `MaybeStorageDead`. This commit changes it to use `maybe_init` and `maybe_uninit`.
1 parent b059ea8 commit 119fbd3

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

compiler/rustc_mir_transform/src/elaborate_drops.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl InitializationData<'_, '_> {
127127
self.uninits.seek_before_primary_effect(loc);
128128
}
129129

130-
fn maybe_live_dead(&self, path: MovePathIndex) -> (bool, bool) {
130+
fn maybe_init_uninit(&self, path: MovePathIndex) -> (bool, bool) {
131131
(self.inits.get().contains(path), self.uninits.get().contains(path))
132132
}
133133
}
@@ -153,23 +153,23 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for ElaborateDropsCtxt<'a, 'tcx> {
153153

154154
#[instrument(level = "debug", skip(self), ret)]
155155
fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle {
156-
let ((maybe_live, maybe_dead), multipart) = match mode {
157-
DropFlagMode::Shallow => (self.init_data.maybe_live_dead(path), false),
156+
let ((maybe_init, maybe_uninit), multipart) = match mode {
157+
DropFlagMode::Shallow => (self.init_data.maybe_init_uninit(path), false),
158158
DropFlagMode::Deep => {
159-
let mut some_live = false;
160-
let mut some_dead = false;
159+
let mut some_maybe_init = false;
160+
let mut some_maybe_uninit = false;
161161
let mut children_count = 0;
162162
on_all_children_bits(self.move_data(), path, |child| {
163-
let (live, dead) = self.init_data.maybe_live_dead(child);
164-
debug!("elaborate_drop: state({:?}) = {:?}", child, (live, dead));
165-
some_live |= live;
166-
some_dead |= dead;
163+
let (maybe_init, maybe_uninit) = self.init_data.maybe_init_uninit(child);
164+
debug!("elaborate_drop: state({:?}) = {:?}", child, (maybe_init, maybe_uninit));
165+
some_maybe_init |= maybe_init;
166+
some_maybe_uninit |= maybe_uninit;
167167
children_count += 1;
168168
});
169-
((some_live, some_dead), children_count != 1)
169+
((some_maybe_init, some_maybe_uninit), children_count != 1)
170170
}
171171
};
172-
match (maybe_live, maybe_dead, multipart) {
172+
match (maybe_init, maybe_uninit, multipart) {
173173
(false, _, _) => DropStyle::Dead,
174174
(true, false, _) => DropStyle::Static,
175175
(true, true, false) => DropStyle::Conditional,
@@ -283,15 +283,15 @@ impl<'a, 'tcx> ElaborateDropsCtxt<'a, 'tcx> {
283283
LookupResult::Exact(path) => {
284284
self.init_data.seek_before(self.body.terminator_loc(bb));
285285
on_all_children_bits(self.move_data(), path, |child| {
286-
let (maybe_live, maybe_dead) = self.init_data.maybe_live_dead(child);
286+
let (maybe_init, maybe_uninit) = self.init_data.maybe_init_uninit(child);
287287
debug!(
288288
"collect_drop_flags: collecting {:?} from {:?}@{:?} - {:?}",
289289
child,
290290
place,
291291
path,
292-
(maybe_live, maybe_dead)
292+
(maybe_init, maybe_uninit)
293293
);
294-
if maybe_live && maybe_dead {
294+
if maybe_init && maybe_uninit {
295295
self.create_drop_flag(child, terminator.source_info.span)
296296
}
297297
});
@@ -303,8 +303,8 @@ impl<'a, 'tcx> ElaborateDropsCtxt<'a, 'tcx> {
303303
}
304304

305305
self.init_data.seek_before(self.body.terminator_loc(bb));
306-
let (_maybe_live, maybe_dead) = self.init_data.maybe_live_dead(parent);
307-
if maybe_dead {
306+
let (_maybe_init, maybe_uninit) = self.init_data.maybe_init_uninit(parent);
307+
if maybe_uninit {
308308
self.tcx.dcx().span_delayed_bug(
309309
terminator.source_info.span,
310310
format!(

0 commit comments

Comments
 (0)