diff options
| author | Xavier Denis <xldenis@gmail.com> | 2021-10-25 22:16:07 +0200 |
|---|---|---|
| committer | Xavier Denis <xldenis@gmail.com> | 2021-10-25 22:16:07 +0200 |
| commit | 9894a9a71674e72d4b5428bb03ce6b222bb89f09 (patch) | |
| tree | 584c07832b94b0d9a5d5f09218e4231b6cd75753 /compiler | |
| parent | cf708558b758f4473c4f35986d9492ace7bf906d (diff) | |
| download | rust-9894a9a71674e72d4b5428bb03ce6b222bb89f09.tar.gz rust-9894a9a71674e72d4b5428bb03ce6b222bb89f09.zip | |
Add BorrowSet to public api
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_borrowck/src/borrow_set.rs | 26 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/lib.rs | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_borrowck/src/borrow_set.rs b/compiler/rustc_borrowck/src/borrow_set.rs index e30d6c7fca7..952e18c1e57 100644 --- a/compiler/rustc_borrowck/src/borrow_set.rs +++ b/compiler/rustc_borrowck/src/borrow_set.rs @@ -12,22 +12,22 @@ use rustc_mir_dataflow::move_paths::MoveData; use std::fmt; use std::ops::Index; -crate struct BorrowSet<'tcx> { +pub struct BorrowSet<'tcx> { /// The fundamental map relating bitvector indexes to the borrows /// in the MIR. Each borrow is also uniquely identified in the MIR /// by the `Location` of the assignment statement in which it /// appears on the right hand side. Thus the location is the map /// key, and its position in the map corresponds to `BorrowIndex`. - crate location_map: FxIndexMap<Location, BorrowData<'tcx>>, + pub location_map: FxIndexMap<Location, BorrowData<'tcx>>, /// Locations which activate borrows. /// 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. - crate activation_map: FxHashMap<Location, Vec<BorrowIndex>>, + pub activation_map: FxHashMap<Location, Vec<BorrowIndex>>, /// Map from local to all the borrows on that local. - crate local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>, + pub local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>, crate locals_state_at_exit: LocalsStateAtExit, } @@ -43,27 +43,27 @@ impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> { /// Location where a two-phase borrow is activated, if a borrow /// is in fact a two-phase borrow. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -crate enum TwoPhaseActivation { +pub enum TwoPhaseActivation { NotTwoPhase, NotActivated, ActivatedAt(Location), } #[derive(Debug, Clone)] -crate struct BorrowData<'tcx> { +pub struct BorrowData<'tcx> { /// Location where the borrow reservation starts. /// In many cases, this will be equal to the activation location but not always. - crate reserve_location: Location, + pub reserve_location: Location, /// Location where the borrow is activated. - crate activation_location: TwoPhaseActivation, + pub activation_location: TwoPhaseActivation, /// What kind of borrow this is - crate kind: mir::BorrowKind, + pub kind: mir::BorrowKind, /// The region for which this borrow is live - crate region: RegionVid, + pub region: RegionVid, /// Place from which we are borrowing - crate borrowed_place: mir::Place<'tcx>, + pub borrowed_place: mir::Place<'tcx>, /// Place to which the borrow was stored - crate assigned_place: mir::Place<'tcx>, + pub assigned_place: mir::Place<'tcx>, } impl<'tcx> fmt::Display for BorrowData<'tcx> { @@ -78,7 +78,7 @@ impl<'tcx> fmt::Display for BorrowData<'tcx> { } } -crate enum LocalsStateAtExit { +pub enum LocalsStateAtExit { AllAreInvalidated, SomeAreInvalidated { has_storage_dead_or_moved: BitSet<Local> }, } diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 08df87e0488..f698ffb6aeb 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -64,7 +64,7 @@ use facts::AllFacts; use self::path_utils::*; -mod borrow_set; +pub mod borrow_set; mod borrowck_errors; mod constraint_generation; mod constraints; |
