diff options
| author | Will Crichton <wcrichto@cs.stanford.edu> | 2024-12-11 16:40:54 -0800 |
|---|---|---|
| committer | Will Crichton <wcrichto@cs.stanford.edu> | 2024-12-11 17:28:49 -0800 |
| commit | eb10db0a76fdacdbe6747431aea90f17ce4ec7c1 (patch) | |
| tree | 924fccab0493ff09fe19850ec01be287081d621b /compiler/rustc_borrowck | |
| parent | 1f3bf231e160b9869e2a85260fd6805304bfcee2 (diff) | |
| download | rust-eb10db0a76fdacdbe6747431aea90f17ce4ec7c1.tar.gz rust-eb10db0a76fdacdbe6747431aea90f17ce4ec7c1.zip | |
Make some types and methods related to Polonius + Miri public.
Diffstat (limited to 'compiler/rustc_borrowck')
| -rw-r--r-- | compiler/rustc_borrowck/src/borrow_set.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/consumers.rs | 4 |
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 16b3d901956..d66f613c71e 100644 --- a/compiler/rustc_borrowck/src/borrow_set.rs +++ b/compiler/rustc_borrowck/src/borrow_set.rs @@ -20,18 +20,18 @@ pub struct BorrowSet<'tcx> { /// 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`. - pub(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. - pub(crate) activation_map: FxIndexMap<Location, Vec<BorrowIndex>>, + pub activation_map: FxIndexMap<Location, Vec<BorrowIndex>>, /// Map from local to all the borrows on that local. - pub(crate) local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>, + pub local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>, - pub(crate) locals_state_at_exit: LocalsStateAtExit, + pub locals_state_at_exit: LocalsStateAtExit, } impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> { @@ -45,7 +45,7 @@ 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)] -pub(crate) enum TwoPhaseActivation { +pub enum TwoPhaseActivation { NotTwoPhase, NotActivated, ActivatedAt(Location), @@ -55,17 +55,17 @@ pub(crate) enum TwoPhaseActivation { pub struct BorrowData<'tcx> { /// Location where the borrow reservation starts. /// In many cases, this will be equal to the activation location but not always. - pub(crate) reserve_location: Location, + pub reserve_location: Location, /// Location where the borrow is activated. - pub(crate) activation_location: TwoPhaseActivation, + pub activation_location: TwoPhaseActivation, /// What kind of borrow this is - pub(crate) kind: mir::BorrowKind, + pub kind: mir::BorrowKind, /// The region for which this borrow is live - pub(crate) region: RegionVid, + pub region: RegionVid, /// Place from which we are borrowing - pub(crate) borrowed_place: mir::Place<'tcx>, + pub borrowed_place: mir::Place<'tcx>, /// Place to which the borrow was stored - pub(crate) assigned_place: mir::Place<'tcx>, + pub assigned_place: mir::Place<'tcx>, } impl<'tcx> fmt::Display for BorrowData<'tcx> { @@ -120,7 +120,7 @@ impl LocalsStateAtExit { } impl<'tcx> BorrowSet<'tcx> { - pub(crate) fn build( + pub fn build( tcx: TyCtxt<'tcx>, body: &Body<'tcx>, locals_are_invalidated_at_exit: bool, diff --git a/compiler/rustc_borrowck/src/consumers.rs b/compiler/rustc_borrowck/src/consumers.rs index 7ace38c3e85..74de766ba23 100644 --- a/compiler/rustc_borrowck/src/consumers.rs +++ b/compiler/rustc_borrowck/src/consumers.rs @@ -5,15 +5,15 @@ use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::{Body, Promoted}; use rustc_middle::ty::TyCtxt; +pub use super::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation}; pub use super::constraints::OutlivesConstraint; pub use super::dataflow::{BorrowIndex, Borrows, calculate_borrows_out_of_scope_at_location}; -pub use super::facts::{AllFacts as PoloniusInput, RustcFacts}; +pub use super::facts::{AllFacts as PoloniusInput, PoloniusRegionVid, RustcFacts}; pub use super::location::{LocationTable, RichLocation}; pub use super::nll::PoloniusOutput; pub use super::place_ext::PlaceExt; pub use super::places_conflict::{PlaceConflictBias, places_conflict}; pub use super::region_infer::RegionInferenceContext; -use crate::borrow_set::BorrowSet; /// Options determining the output behavior of [`get_body_with_borrowck_facts`]. /// |
