Skip to content

Commit 6676cec

Browse files
committed
Reduce visibilities.
1 parent e3a918e commit 6676cec

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed

compiler/rustc_borrowck/src/borrow_set.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ pub struct BorrowSet<'tcx> {
2020
/// by the `Location` of the assignment statement in which it
2121
/// appears on the right hand side. Thus the location is the map
2222
/// key, and its position in the map corresponds to `BorrowIndex`.
23-
pub location_map: FxIndexMap<Location, BorrowData<'tcx>>,
23+
pub(crate) location_map: FxIndexMap<Location, BorrowData<'tcx>>,
2424

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

3131
/// Map from local to all the borrows on that local.
32-
pub local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>,
32+
pub(crate) local_map: FxIndexMap<mir::Local, FxIndexSet<BorrowIndex>>,
3333

34-
pub locals_state_at_exit: LocalsStateAtExit,
34+
pub(crate) locals_state_at_exit: LocalsStateAtExit,
3535
}
3636

3737
impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
@@ -45,7 +45,7 @@ impl<'tcx> Index<BorrowIndex> for BorrowSet<'tcx> {
4545
/// Location where a two-phase borrow is activated, if a borrow
4646
/// is in fact a two-phase borrow.
4747
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
48-
pub enum TwoPhaseActivation {
48+
pub(crate) enum TwoPhaseActivation {
4949
NotTwoPhase,
5050
NotActivated,
5151
ActivatedAt(Location),
@@ -55,17 +55,17 @@ pub enum TwoPhaseActivation {
5555
pub struct BorrowData<'tcx> {
5656
/// Location where the borrow reservation starts.
5757
/// In many cases, this will be equal to the activation location but not always.
58-
pub reserve_location: Location,
58+
pub(crate) reserve_location: Location,
5959
/// Location where the borrow is activated.
60-
pub activation_location: TwoPhaseActivation,
60+
pub(crate) activation_location: TwoPhaseActivation,
6161
/// What kind of borrow this is
62-
pub kind: mir::BorrowKind,
62+
pub(crate) kind: mir::BorrowKind,
6363
/// The region for which this borrow is live
64-
pub region: RegionVid,
64+
pub(crate) region: RegionVid,
6565
/// Place from which we are borrowing
66-
pub borrowed_place: mir::Place<'tcx>,
66+
pub(crate) borrowed_place: mir::Place<'tcx>,
6767
/// Place to which the borrow was stored
68-
pub assigned_place: mir::Place<'tcx>,
68+
pub(crate) assigned_place: mir::Place<'tcx>,
6969
}
7070

7171
impl<'tcx> fmt::Display for BorrowData<'tcx> {
@@ -120,7 +120,7 @@ impl LocalsStateAtExit {
120120
}
121121

122122
impl<'tcx> BorrowSet<'tcx> {
123-
pub fn build(
123+
pub(crate) fn build(
124124
tcx: TyCtxt<'tcx>,
125125
body: &Body<'tcx>,
126126
locals_are_invalidated_at_exit: bool,
@@ -156,7 +156,7 @@ impl<'tcx> BorrowSet<'tcx> {
156156
self.activation_map.get(&location).map_or(&[], |activations| &activations[..])
157157
}
158158

159-
pub fn len(&self) -> usize {
159+
pub(crate) fn len(&self) -> usize {
160160
self.location_map.len()
161161
}
162162

compiler/rustc_borrowck/src/constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'tcx> fmt::Debug for OutlivesConstraint<'tcx> {
210210

211211
rustc_index::newtype_index! {
212212
#[debug_format = "OutlivesConstraintIndex({})"]
213-
pub struct OutlivesConstraintIndex {}
213+
pub(crate) struct OutlivesConstraintIndex {}
214214
}
215215

216216
rustc_index::newtype_index! {

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2733,7 +2733,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
27332733
/// cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
27342734
/// mutable (via `a.u.s.b`) [E0502]
27352735
/// ```
2736-
pub(crate) fn describe_place_for_conflicting_borrow(
2736+
fn describe_place_for_conflicting_borrow(
27372737
&self,
27382738
first_borrowed_place: Place<'tcx>,
27392739
second_borrowed_place: Place<'tcx>,

compiler/rustc_borrowck/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use self::path_utils::*;
5555
use self::prefixes::PrefixSet;
5656
use crate::session_diagnostics::VarNeedNotMut;
5757

58-
pub mod borrow_set;
58+
mod borrow_set;
5959
mod borrowck_errors;
6060
mod constraints;
6161
mod dataflow;
@@ -434,7 +434,7 @@ fn do_mir_borrowck<'tcx>(
434434
(result, body_with_facts)
435435
}
436436

437-
pub struct BorrowckInferCtxt<'tcx> {
437+
pub(crate) struct BorrowckInferCtxt<'tcx> {
438438
pub(crate) infcx: InferCtxt<'tcx>,
439439
pub(crate) reg_var_to_origin: RefCell<FxIndexMap<ty::RegionVid, RegionCtxt>>,
440440
}

compiler/rustc_borrowck/src/region_infer/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -553,20 +553,22 @@ impl<'tcx> RegionInferenceContext<'tcx> {
553553
}
554554

555555
/// Returns an iterator over all the region indices.
556-
pub fn regions(&self) -> impl Iterator<Item = RegionVid> + 'tcx {
556+
pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> + 'tcx {
557557
self.definitions.indices()
558558
}
559559

560560
/// Given a universal region in scope on the MIR, returns the
561561
/// corresponding index.
562562
///
563563
/// (Panics if `r` is not a registered universal region.)
564-
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
564+
pub(crate) fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
565565
self.universal_regions.to_region_vid(r)
566566
}
567567

568568
/// Returns an iterator over all the outlives constraints.
569-
pub fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> + '_ {
569+
pub(crate) fn outlives_constraints(
570+
&self,
571+
) -> impl Iterator<Item = OutlivesConstraint<'tcx>> + '_ {
570572
self.constraints.outlives().iter().copied()
571573
}
572574

compiler/rustc_borrowck/src/region_infer/values.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::BorrowIndex;
1515
rustc_index::newtype_index! {
1616
/// A single integer representing a `ty::Placeholder`.
1717
#[debug_format = "PlaceholderIndex({})"]
18-
pub struct PlaceholderIndex {}
18+
pub(crate) struct PlaceholderIndex {}
1919
}
2020

2121
/// An individual element in a region value -- the value of a

0 commit comments

Comments
 (0)