Skip to content

Commit 9894a9a

Browse files
committed
Add BorrowSet to public api
1 parent cf70855 commit 9894a9a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

compiler/rustc_borrowck/src/borrow_set.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ use rustc_mir_dataflow::move_paths::MoveData;
1212
use std::fmt;
1313
use std::ops::Index;
1414

15-
crate struct BorrowSet<'tcx> {
15+
pub struct BorrowSet<'tcx> {
1616
/// The fundamental map relating bitvector indexes to the borrows
1717
/// in the MIR. Each borrow is also uniquely identified in the MIR
1818
/// by the `Location` of the assignment statement in which it
1919
/// appears on the right hand side. Thus the location is the map
2020
/// key, and its position in the map corresponds to `BorrowIndex`.
21-
crate location_map: FxIndexMap<Location, BorrowData<'tcx>>,
21+
pub location_map: FxIndexMap<Location, BorrowData<'tcx>>,
2222

2323
/// Locations which activate borrows.
2424
/// NOTE: a given location may activate more than one borrow in the future
2525
/// when more general two-phase borrow support is introduced, but for now we
2626
/// only need to store one borrow index.
27-
crate activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
27+
pub activation_map: FxHashMap<Location, Vec<BorrowIndex>>,
2828

2929
/// Map from local to all the borrows on that local.
30-
crate local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
30+
pub local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
3131

3232
crate locals_state_at_exit: LocalsStateAtExit,
3333
}
@@ -43,27 +43,27 @@ impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
4343
/// Location where a two-phase borrow is activated, if a borrow
4444
/// is in fact a two-phase borrow.
4545
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
46-
crate enum TwoPhaseActivation {
46+
pub enum TwoPhaseActivation {
4747
NotTwoPhase,
4848
NotActivated,
4949
ActivatedAt(Location),
5050
}
5151

5252
#[derive(Debug, Clone)]
53-
crate struct BorrowData<'tcx> {
53+
pub struct BorrowData<'tcx> {
5454
/// Location where the borrow reservation starts.
5555
/// In many cases, this will be equal to the activation location but not always.
56-
crate reserve_location: Location,
56+
pub reserve_location: Location,
5757
/// Location where the borrow is activated.
58-
crate activation_location: TwoPhaseActivation,
58+
pub activation_location: TwoPhaseActivation,
5959
/// What kind of borrow this is
60-
crate kind: mir::BorrowKind,
60+
pub kind: mir::BorrowKind,
6161
/// The region for which this borrow is live
62-
crate region: RegionVid,
62+
pub region: RegionVid,
6363
/// Place from which we are borrowing
64-
crate borrowed_place: mir::Place<'tcx>,
64+
pub borrowed_place: mir::Place<'tcx>,
6565
/// Place to which the borrow was stored
66-
crate assigned_place: mir::Place<'tcx>,
66+
pub assigned_place: mir::Place<'tcx>,
6767
}
6868

6969
impl<'tcx> fmt::Display for BorrowData<'tcx> {
@@ -78,7 +78,7 @@ impl<'tcx> fmt::Display for BorrowData<'tcx> {
7878
}
7979
}
8080

81-
crate enum LocalsStateAtExit {
81+
pub enum LocalsStateAtExit {
8282
AllAreInvalidated,
8383
SomeAreInvalidated { has_storage_dead_or_moved: BitSet<Local> },
8484
}

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use facts::AllFacts;
6464

6565
use self::path_utils::*;
6666

67-
mod borrow_set;
67+
pub mod borrow_set;
6868
mod borrowck_errors;
6969
mod constraint_generation;
7070
mod constraints;

0 commit comments

Comments
 (0)