diff options
Diffstat (limited to 'compiler/rustc_borrowck/src/borrow_set.rs')
-rw-r--r-- | compiler/rustc_borrowck/src/borrow_set.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/rustc_borrowck/src/borrow_set.rs b/compiler/rustc_borrowck/src/borrow_set.rs index 5bb92a358..4824f6346 100644 --- a/compiler/rustc_borrowck/src/borrow_set.rs +++ b/compiler/rustc_borrowck/src/borrow_set.rs @@ -1,10 +1,9 @@ #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] -use crate::nll::ToRegionVid; use crate::path_utils::allow_two_phase_borrow; use crate::place_ext::PlaceExt; use crate::BorrowIndex; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_index::bit_set::BitSet; use rustc_middle::mir::traversal; use rustc_middle::mir::visit::{MutatingUseContext, NonUseContext, PlaceContext, Visitor}; @@ -26,10 +25,10 @@ pub struct BorrowSet<'tcx> { /// NOTE: a given location may activate more than one borrow in the future /// when more general two-phase borrow support is introduced, but for now we /// only need to store one borrow index. - pub activation_map: FxHashMap<Location, Vec<BorrowIndex>>, + pub activation_map: FxIndexMap<Location, Vec<BorrowIndex>>, /// Map from local to all the borrows on that local. - pub local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>, + pub local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>, pub(crate) locals_state_at_exit: LocalsStateAtExit, } @@ -175,8 +174,8 @@ struct GatherBorrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, location_map: FxIndexMap<Location, BorrowData<'tcx>>, - activation_map: FxHashMap<Location, Vec<BorrowIndex>>, - local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>, + activation_map: FxIndexMap<Location, Vec<BorrowIndex>>, + local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>, /// When we encounter a 2-phase borrow statement, it will always /// be assigning into a temporary TEMP: @@ -186,7 +185,7 @@ struct GatherBorrows<'a, 'tcx> { /// We add TEMP into this map with `b`, where `b` is the index of /// the borrow. When we find a later use of this activation, we /// remove from the map (and add to the "tombstone" set below). - pending_activations: FxHashMap<mir::Local, BorrowIndex>, + pending_activations: FxIndexMap<mir::Local, BorrowIndex>, locals_state_at_exit: LocalsStateAtExit, } @@ -204,7 +203,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> { return; } - let region = region.to_region_vid(); + let region = region.as_var(); let borrow = BorrowData { kind, @@ -279,7 +278,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> { let borrow_data = &self.location_map[&location]; assert_eq!(borrow_data.reserve_location, location); assert_eq!(borrow_data.kind, kind); - assert_eq!(borrow_data.region, region.to_region_vid()); + assert_eq!(borrow_data.region, region.as_var()); assert_eq!(borrow_data.borrowed_place, place); } |