Skip to content

Commit 94697ba

Browse files
committed
rename LocalWithRegion to LiveVar
1 parent 4374855 commit 94697ba

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
//! For the NLL computation, we need to compute liveness, but only for those
1212
//! local variables whose types contain regions. The others are not of interest
13-
//! to us. This file defines a new index type (LocalWithRegion) that indexes into
13+
//! to us. This file defines a new index type (LiveVar) that indexes into
1414
//! a list of "variables whose type contain regions". It also defines a map from
15-
//! Local to LocalWithRegion and vice versa -- this map can be given to the
15+
//! Local to LiveVar and vice versa -- this map can be given to the
1616
//! liveness code so that it only operates over variables with regions in their
1717
//! types, instead of all variables.
1818
@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
2323
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2424
use util::liveness::LiveVariableMap;
2525

26-
/// Map between Local and LocalWithRegion indices: the purpose of this
26+
/// Map between Local and LiveVar indices: the purpose of this
2727
/// map is to define the subset of local variables for which we need
2828
/// to do a liveness computation. We only need to compute whether a
2929
/// variable `X` is live if that variable contains some region `R` in
@@ -32,18 +32,18 @@ use util::liveness::LiveVariableMap;
3232
crate struct NllLivenessMap {
3333
/// For each local variable, contains `Some(i)` if liveness is
3434
/// needed for this variable.
35-
pub from_local: IndexVec<Local, Option<LocalWithRegion>>,
35+
pub from_local: IndexVec<Local, Option<LiveVar>>,
3636

37-
/// For each `LocalWithRegion`, maps back to the original `Local` index.
38-
pub to_local: IndexVec<LocalWithRegion, Local>,
37+
/// For each `LiveVar`, maps back to the original `Local` index.
38+
pub to_local: IndexVec<LiveVar, Local>,
3939
}
4040

4141
impl LiveVariableMap for NllLivenessMap {
4242
fn from_local(&self, local: Local) -> Option<Self::LiveVar> {
4343
self.from_local[local]
4444
}
4545

46-
type LiveVar = LocalWithRegion;
46+
type LiveVar = LiveVar;
4747

4848
fn from_live_var(&self, local: Self::LiveVar) -> Local {
4949
self.to_local[local]
@@ -94,4 +94,4 @@ impl NllLivenessMap {
9494
}
9595

9696
/// Index given to each local variable whose type contains a region.
97-
newtype_index!(LocalWithRegion);
97+
newtype_index!(LiveVar);

src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements};
12-
use borrow_check::nll::type_check::liveness::liveness_map::{LocalWithRegion, NllLivenessMap};
12+
use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
1313
use rustc::mir::visit::{PlaceContext, Visitor};
1414
use rustc::mir::{Local, Location, Mir};
1515
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
@@ -27,18 +27,18 @@ crate struct LocalUseMap<'me> {
2727
/// defined in `x = y` but not `y`; that first def is the head of
2828
/// a linked list that lets you enumerate all places the variable
2929
/// is assigned.
30-
first_def_at: IndexVec<LocalWithRegion, Option<AppearanceIndex>>,
30+
first_def_at: IndexVec<LiveVar, Option<AppearanceIndex>>,
3131

3232
/// Head of a linked list of **uses** of each variable -- use in
3333
/// this context means that the existing value of the variable is
3434
/// read or modified. e.g., `y` is used in `x = y` but not `x`.
3535
/// Note that `DROP(x)` terminators are excluded from this list.
36-
first_use_at: IndexVec<LocalWithRegion, Option<AppearanceIndex>>,
36+
first_use_at: IndexVec<LiveVar, Option<AppearanceIndex>>,
3737

3838
/// Head of a linked list of **drops** of each variable -- these
3939
/// are a special category of uses corresponding to the drop that
4040
/// we add for each local variable.
41-
first_drop_at: IndexVec<LocalWithRegion, Option<AppearanceIndex>>,
41+
first_drop_at: IndexVec<LiveVar, Option<AppearanceIndex>>,
4242

4343
appearances: IndexVec<AppearanceIndex, Appearance>,
4444
}
@@ -81,17 +81,17 @@ impl LocalUseMap<'me> {
8181
local_use_map
8282
}
8383

84-
crate fn defs(&self, local: LocalWithRegion) -> impl Iterator<Item = PointIndex> + '_ {
84+
crate fn defs(&self, local: LiveVar) -> impl Iterator<Item = PointIndex> + '_ {
8585
vll::iter(self.first_def_at[local], &self.appearances)
8686
.map(move |aa| self.appearances[aa].point_index)
8787
}
8888

89-
crate fn uses(&self, local: LocalWithRegion) -> impl Iterator<Item = PointIndex> + '_ {
89+
crate fn uses(&self, local: LiveVar) -> impl Iterator<Item = PointIndex> + '_ {
9090
vll::iter(self.first_use_at[local], &self.appearances)
9191
.map(move |aa| self.appearances[aa].point_index)
9292
}
9393

94-
crate fn drops(&self, local: LocalWithRegion) -> impl Iterator<Item = PointIndex> + '_ {
94+
crate fn drops(&self, local: LiveVar) -> impl Iterator<Item = PointIndex> + '_ {
9595
vll::iter(self.first_drop_at[local], &self.appearances)
9696
.map(move |aa| self.appearances[aa].point_index)
9797
}
@@ -103,7 +103,7 @@ struct LocalUseMapBuild<'me, 'map> {
103103
}
104104

105105
impl LocalUseMapBuild<'_, '_> {
106-
fn insert_def(&mut self, local: LocalWithRegion, location: Location) {
106+
fn insert_def(&mut self, local: LiveVar, location: Location) {
107107
Self::insert(
108108
self.elements,
109109
&mut self.local_use_map.first_def_at[local],
@@ -112,7 +112,7 @@ impl LocalUseMapBuild<'_, '_> {
112112
);
113113
}
114114

115-
fn insert_use(&mut self, local: LocalWithRegion, location: Location) {
115+
fn insert_use(&mut self, local: LiveVar, location: Location) {
116116
Self::insert(
117117
self.elements,
118118
&mut self.local_use_map.first_use_at[local],
@@ -121,7 +121,7 @@ impl LocalUseMapBuild<'_, '_> {
121121
);
122122
}
123123

124-
fn insert_drop(&mut self, local: LocalWithRegion, location: Location) {
124+
fn insert_drop(&mut self, local: LiveVar, location: Location) {
125125
Self::insert(
126126
self.elements,
127127
&mut self.local_use_map.first_drop_at[local],

src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements};
12-
use borrow_check::nll::type_check::liveness::liveness_map::{LocalWithRegion, NllLivenessMap};
12+
use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
1313
use borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap;
1414
use borrow_check::nll::type_check::liveness::point_index_map::PointIndexMap;
1515
use borrow_check::nll::type_check::AtLocation;
@@ -194,7 +194,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> {
194194
}
195195

196196
/// Adds the definitions of `local` into `self.defs`.
197-
fn add_defs_for(&mut self, live_local: LocalWithRegion) {
197+
fn add_defs_for(&mut self, live_local: LiveVar) {
198198
for def in self.cx.local_use_map.defs(live_local) {
199199
debug!("- defined at {:?}", def);
200200
self.defs.insert(def);
@@ -207,7 +207,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> {
207207
/// find a `def` of local.
208208
///
209209
/// Requires `add_defs_for(live_local)` to have been executed.
210-
fn compute_use_live_points_for(&mut self, live_local: LocalWithRegion) {
210+
fn compute_use_live_points_for(&mut self, live_local: LiveVar) {
211211
debug!("compute_use_live_points_for(live_local={:?})", live_local);
212212

213213
self.stack.extend(self.cx.local_use_map.uses(live_local));
@@ -233,7 +233,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> {
233233
///
234234
/// Requires `compute_use_live_points_for` and `add_defs_for` to
235235
/// have been executed.
236-
fn compute_drop_live_points_for(&mut self, live_local: LocalWithRegion) {
236+
fn compute_drop_live_points_for(&mut self, live_local: LiveVar) {
237237
debug!("compute_drop_live_points_for(live_local={:?})", live_local);
238238

239239
let local = self.cx.liveness_map.from_live_var(live_local);

0 commit comments

Comments
 (0)