Skip to content

Commit 0819ba9

Browse files
committed
mir/mod.rs / visit.rs reverted back to using Local
1 parent 0d847ec commit 0819ba9

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/librustc/mir/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub mod traversal;
5252
pub mod visit;
5353

5454
/// Types for locals
55-
type LocalDecls<'tcx> = IndexVec<LocalWithRegion, LocalDecl<'tcx>>;
55+
type LocalDecls<'tcx> = IndexVec<Local, LocalDecl<'tcx>>;
5656

5757
pub trait HasLocalDecls<'tcx> {
5858
fn local_decls(&self) -> &LocalDecls<'tcx>;
@@ -141,7 +141,7 @@ impl<'tcx> Mir<'tcx> {
141141
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
142142
promoted: IndexVec<Promoted, Mir<'tcx>>,
143143
yield_ty: Option<Ty<'tcx>>,
144-
local_decls: IndexVec<LocalWithRegion, LocalDecl<'tcx>>,
144+
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
145145
arg_count: usize,
146146
upvar_decls: Vec<UpvarDecl>,
147147
span: Span,
@@ -209,7 +209,7 @@ impl<'tcx> Mir<'tcx> {
209209
}
210210

211211
#[inline]
212-
pub fn local_kind(&self, local: LocalWithRegion) -> LocalKind {
212+
pub fn local_kind(&self, local: Local) -> LocalKind {
213213
let index = local.0 as usize;
214214
if index == 0 {
215215
debug_assert!(
@@ -234,9 +234,9 @@ impl<'tcx> Mir<'tcx> {
234234

235235
/// Returns an iterator over all temporaries.
236236
#[inline]
237-
pub fn temps_iter<'a>(&'a self) -> impl Iterator<Item = LocalWithRegion> + 'a {
237+
pub fn temps_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a {
238238
(self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
239-
let local = LocalWithRegion::new(index);
239+
let local = Local::new(index);
240240
if self.local_decls[local].is_user_variable.is_some() {
241241
None
242242
} else {
@@ -247,9 +247,9 @@ impl<'tcx> Mir<'tcx> {
247247

248248
/// Returns an iterator over all user-declared locals.
249249
#[inline]
250-
pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item = LocalWithRegion> + 'a {
250+
pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a {
251251
(self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
252-
let local = LocalWithRegion::new(index);
252+
let local = Local::new(index);
253253
if self.local_decls[local].is_user_variable.is_some() {
254254
Some(local)
255255
} else {
@@ -260,9 +260,9 @@ impl<'tcx> Mir<'tcx> {
260260

261261
/// Returns an iterator over all user-declared mutable arguments and locals.
262262
#[inline]
263-
pub fn mut_vars_and_args_iter<'a>(&'a self) -> impl Iterator<Item = LocalWithRegion> + 'a {
263+
pub fn mut_vars_and_args_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a {
264264
(1..self.local_decls.len()).filter_map(move |index| {
265-
let local = LocalWithRegion::new(index);
265+
let local = Local::new(index);
266266
let decl = &self.local_decls[local];
267267
if (decl.is_user_variable.is_some() || index < self.arg_count + 1)
268268
&& decl.mutability == Mutability::Mut

src/librustc/mir/visit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ macro_rules! make_mir_visitor {
146146

147147
fn visit_user_assert_ty(&mut self,
148148
c_ty: & $($mutability)* CanonicalTy<'tcx>,
149-
local: & $($mutability)* LocalWithRegion,
149+
local: & $($mutability)* Local,
150150
location: Location) {
151151
self.super_user_assert_ty(c_ty, local, location);
152152
}
@@ -250,13 +250,13 @@ macro_rules! make_mir_visitor {
250250
}
251251

252252
fn visit_local_decl(&mut self,
253-
local: LocalWithRegion,
253+
local: Local,
254254
local_decl: & $($mutability)* LocalDecl<'tcx>) {
255255
self.super_local_decl(local, local_decl);
256256
}
257257

258258
fn visit_local(&mut self,
259-
_local: & $($mutability)* LocalWithRegion,
259+
_local: & $($mutability)* Local,
260260
_context: PlaceContext<'tcx>,
261261
_location: Location) {
262262
}
@@ -632,7 +632,7 @@ macro_rules! make_mir_visitor {
632632

633633
fn super_user_assert_ty(&mut self,
634634
_c_ty: & $($mutability)* CanonicalTy<'tcx>,
635-
local: & $($mutability)* LocalWithRegion,
635+
local: & $($mutability)* Local,
636636
location: Location) {
637637
self.visit_local(local, PlaceContext::Validate, location);
638638
}
@@ -708,7 +708,7 @@ macro_rules! make_mir_visitor {
708708
}
709709

710710
fn super_local_decl(&mut self,
711-
local: LocalWithRegion,
711+
local: Local,
712712
local_decl: & $($mutability)* LocalDecl<'tcx>) {
713713
let LocalDecl {
714714
mutability: _,

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
278278
// Note that this set is expected to be small - only upvars from closures
279279
// would have a chance of erroneously adding non-user-defined mutable vars
280280
// to the set.
281-
let temporary_used_locals: FxHashSet<LocalWithRegion> = mbcx
281+
let temporary_used_locals: FxHashSet<Local> = mbcx
282282
.used_mut
283283
.iter()
284284
.filter(|&local| !mbcx.mir.local_decls[*local].is_user_variable.is_some())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
192192
/// particular this takes `#[may_dangle]` into account.
193193
fn add_drop_live_constraint(
194194
&mut self,
195-
dropped_local: Local,
195+
dropped_local: LocalWithRegion,
196196
dropped_ty: Ty<'tcx>,
197197
location: Location,
198198
) {

src/librustc_mir/dataflow/impls/borrowed_locals.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,34 @@ impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> {
3737
}
3838

3939
impl<'a, 'tcx> BitDenotation for HaveBeenBorrowedLocals<'a, 'tcx> {
40-
type Idx = LocalWithRegion;
40+
type Idx = Local;
4141
fn name() -> &'static str { "has_been_borrowed_locals" }
4242
fn bits_per_block(&self) -> usize {
4343
self.mir.local_decls.len()
4444
}
4545

46-
fn start_block_effect(&self, _sets: &mut IdxSet<LocalWithRegion>) {
46+
fn start_block_effect(&self, _sets: &mut IdxSet<Local>) {
4747
// Nothing is borrowed on function entry
4848
}
4949

5050
fn statement_effect(&self,
51-
sets: &mut BlockSets<LocalWithRegion>,
51+
sets: &mut BlockSets<Local>,
5252
loc: Location) {
5353
BorrowedLocalsVisitor {
5454
sets,
5555
}.visit_statement(loc.block, &self.mir[loc.block].statements[loc.statement_index], loc);
5656
}
5757

5858
fn terminator_effect(&self,
59-
sets: &mut BlockSets<LocalWithRegion>,
59+
sets: &mut BlockSets<Local>,
6060
loc: Location) {
6161
BorrowedLocalsVisitor {
6262
sets,
6363
}.visit_terminator(loc.block, self.mir[loc.block].terminator(), loc);
6464
}
6565

6666
fn propagate_call_return(&self,
67-
_in_out: &mut IdxSet<LocalWithRegion>,
67+
_in_out: &mut IdxSet<Local>,
6868
_call_bb: mir::BasicBlock,
6969
_dest_bb: mir::BasicBlock,
7070
_dest_place: &mir::Place) {
@@ -87,10 +87,10 @@ impl<'a, 'tcx> InitialFlow for HaveBeenBorrowedLocals<'a, 'tcx> {
8787
}
8888

8989
struct BorrowedLocalsVisitor<'b, 'c: 'b> {
90-
sets: &'b mut BlockSets<'c, LocalWithRegion>,
90+
sets: &'b mut BlockSets<'c, Local>,
9191
}
9292

93-
fn find_local<'tcx>(place: &Place<'tcx>) -> Option<LocalWithRegion> {
93+
fn find_local<'tcx>(place: &Place<'tcx>) -> Option<Local> {
9494
match *place {
9595
Place::Local(l) => Some(l),
9696
Place::Static(..) => None,

0 commit comments

Comments
 (0)