Skip to content

Commit 4f5b8ea

Browse files
committed
Remove the region_map field from BorrowSet
1 parent d92287a commit 4f5b8ea

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/librustc_mir/borrow_check/borrow_set.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc::mir::traversal;
1616
use rustc::mir::visit::{
1717
PlaceContext, Visitor, NonUseContext, MutatingUseContext, NonMutatingUseContext
1818
};
19-
use rustc::mir::{self, Location, Mir, Place, Local};
19+
use rustc::mir::{self, Location, Mir, Local};
2020
use rustc::ty::{RegionVid, TyCtxt};
2121
use rustc::util::nodemap::{FxHashMap, FxHashSet};
2222
use rustc_data_structures::indexed_vec::IndexVec;
@@ -41,10 +41,6 @@ crate struct BorrowSet<'tcx> {
4141
/// only need to store one borrow index
4242
crate activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
4343

44-
/// Every borrow has a region; this maps each such regions back to
45-
/// its borrow-indexes.
46-
crate region_map: FxHashMap<RegionVid, FxHashSet<BorrowIndex>>,
47-
4844
/// Map from local to all the borrows on that local
4945
crate local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
5046

@@ -149,7 +145,6 @@ impl<'tcx> BorrowSet<'tcx> {
149145
idx_vec: IndexVec::new(),
150146
location_map: Default::default(),
151147
activation_map: Default::default(),
152-
region_map: Default::default(),
153148
local_map: Default::default(),
154149
pending_activations: Default::default(),
155150
locals_state_at_exit:
@@ -164,7 +159,6 @@ impl<'tcx> BorrowSet<'tcx> {
164159
borrows: visitor.idx_vec,
165160
location_map: visitor.location_map,
166161
activation_map: visitor.activation_map,
167-
region_map: visitor.region_map,
168162
local_map: visitor.local_map,
169163
locals_state_at_exit: visitor.locals_state_at_exit,
170164
}
@@ -184,7 +178,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> {
184178
idx_vec: IndexVec<BorrowIndex, BorrowData<'tcx>>,
185179
location_map: FxHashMap<Location, BorrowIndex>,
186180
activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
187-
region_map: FxHashMap<RegionVid, FxHashSet<BorrowIndex>>,
188181
local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
189182

190183
/// When we encounter a 2-phase borrow statement, it will always
@@ -229,7 +222,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
229222

230223
self.insert_as_pending_if_two_phase(location, &assigned_place, kind, idx);
231224

232-
self.region_map.entry(region).or_default().insert(idx);
233225
if let Some(local) = borrowed_place.root_local() {
234226
self.local_map.entry(local).or_default().insert(idx);
235227
}

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
246246
// re-consider the current implementations of the
247247
// propagate_call_return method.
248248

249-
if let mir::Rvalue::Ref(region, _, ref place) = **rhs {
249+
if let mir::Rvalue::Ref(_, _, ref place) = **rhs {
250250
if place.ignore_borrow(
251251
self.tcx,
252252
self.mir,
@@ -258,13 +258,6 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
258258
panic!("could not find BorrowIndex for location {:?}", location);
259259
});
260260

261-
assert!(self.borrow_set.region_map
262-
.get(&region.to_region_vid())
263-
.unwrap_or_else(|| {
264-
panic!("could not find BorrowIndexs for RegionVid {:?}", region);
265-
})
266-
.contains(&index)
267-
);
268261
sets.gen(*index);
269262

270263
// Issue #46746: Two-phase borrows handles

0 commit comments

Comments
 (0)