Skip to content

Commit 2d2755f

Browse files
committed
Reduce visibilities some more.
It helps people reading the code understand how widely things are used.
1 parent 5c015ee commit 2d2755f

9 files changed

Lines changed: 26 additions & 25 deletions

File tree

‎compiler/rustc_infer/src/infer/mod.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use region_constraints::{
1414
GenericKind,RegionConstraintCollector,RegionConstraintStorage,VarInfos,VerifyBound,
1515
};
1616
pubuse relate::StructurallyRelateAliases;
17-
pubuse relate::combine::{CombineFields,PredicateEmittingRelation};
17+
use relate::combine::CombineFields;
18+
pubuse relate::combine::PredicateEmittingRelation;
1819
use rustc_data_structures::captures::Captures;
1920
use rustc_data_structures::fx::{FxHashSet,FxIndexMap};
2021
use rustc_data_structures::sync::Lrc;
@@ -75,7 +76,7 @@ pub struct InferOk<'tcx, T> {
7576
}
7677
pubtypeInferResult<'tcx,T> = Result<InferOk<'tcx,T>,TypeError<'tcx>>;
7778

78-
pubtypeFixupResult<T> = Result<T,FixupError>;// "fixup result"
79+
pub(crate)typeFixupResult<T> = Result<T,FixupError>;// "fixup result"
7980

8081
pub(crate)typeUnificationTable<'a,'tcx,T> = ut::UnificationTable<
8182
ut::InPlace<T,&'amut ut::UnificationStorage<T>,&'amutInferCtxtUndoLogs<'tcx>>,
@@ -200,7 +201,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
200201
}
201202

202203
#[inline]
203-
pubfnopaque_types(&mutself) -> opaque_types::OpaqueTypeTable<'_,'tcx>{
204+
fnopaque_types(&mutself) -> opaque_types::OpaqueTypeTable<'_,'tcx>{
204205
self.opaque_type_storage.with_log(&mutself.undo_log)
205206
}
206207

@@ -1351,7 +1352,7 @@ impl<'tcx> InferCtxt<'tcx> {
13511352
}
13521353

13531354
/// See the [`region_constraints::RegionConstraintCollector::verify_generic_bound`] method.
1354-
pubfnverify_generic_bound(
1355+
pub(crate)fnverify_generic_bound(
13551356
&self,
13561357
origin:SubregionOrigin<'tcx>,
13571358
kind:GenericKind<'tcx>,

‎compiler/rustc_infer/src/infer/opaque_types/table.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'tcx> Drop for OpaqueTypeStorage<'tcx> {
4646
}
4747
}
4848

49-
pubstructOpaqueTypeTable<'a,'tcx>{
49+
pub(crate)structOpaqueTypeTable<'a,'tcx>{
5050
storage:&'amutOpaqueTypeStorage<'tcx>,
5151

5252
undo_log:&'amutInferCtxtUndoLogs<'tcx>,

‎compiler/rustc_infer/src/infer/outlives/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub mod env;
1414
pubmod for_liveness;
1515
pubmod obligations;
1616
pubmod test_type_match;
17-
pubmod verify;
17+
pub(crate)mod verify;
1818

1919
#[instrument(level = "debug", skip(param_env), ret)]
2020
pubfnexplicit_outlives_bounds<'tcx>(

‎compiler/rustc_infer/src/infer/outlives/verify.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::infer::{GenericKind, VerifyBound};
1515
/// via a "delegate" of type `D` -- this is usually the `infcx`, which
1616
/// accrues them into the `region_obligations` code, but for NLL we
1717
/// use something else.
18-
pubstructVerifyBoundCx<'cx,'tcx>{
18+
pub(crate)structVerifyBoundCx<'cx,'tcx>{
1919
tcx:TyCtxt<'tcx>,
2020
region_bound_pairs:&'cxRegionBoundPairs<'tcx>,
2121
/// During borrowck, if there are no outlives bounds on a generic
@@ -28,7 +28,7 @@ pub struct VerifyBoundCx<'cx, 'tcx> {
2828
}
2929

3030
impl<'cx,'tcx>VerifyBoundCx<'cx,'tcx>{
31-
pubfnnew(
31+
pub(crate)fnnew(
3232
tcx:TyCtxt<'tcx>,
3333
region_bound_pairs:&'cxRegionBoundPairs<'tcx>,
3434
implicit_region_bound:Option<ty::Region<'tcx>>,
@@ -38,7 +38,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
3838
}
3939

4040
#[instrument(level = "debug", skip(self))]
41-
pubfnparam_or_placeholder_bound(&self,ty:Ty<'tcx>) -> VerifyBound<'tcx>{
41+
pub(crate)fnparam_or_placeholder_bound(&self,ty:Ty<'tcx>) -> VerifyBound<'tcx>{
4242
// Start with anything like `T: 'a` we can scrape from the
4343
// environment. If the environment contains something like
4444
// `for<'a> T: 'a`, then we know that `T` outlives everything.
@@ -92,7 +92,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
9292
/// the clause from the environment only applies if `'0 = 'a`,
9393
/// which we don't know yet. But we would still include `'b` in
9494
/// this list.
95-
pubfnapprox_declared_bounds_from_env(
95+
pub(crate)fnapprox_declared_bounds_from_env(
9696
&self,
9797
alias_ty: ty::AliasTy<'tcx>,
9898
) -> Vec<ty::PolyTypeOutlivesPredicate<'tcx>>{
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
101101
}
102102

103103
#[instrument(level = "debug", skip(self))]
104-
pubfnalias_bound(&self,alias_ty: ty::AliasTy<'tcx>) -> VerifyBound<'tcx>{
104+
pub(crate)fnalias_bound(&self,alias_ty: ty::AliasTy<'tcx>) -> VerifyBound<'tcx>{
105105
let alias_ty_as_ty = alias_ty.to_ty(self.tcx);
106106

107107
// Search the env for where clauses like `P: 'a`.
@@ -285,7 +285,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
285285
///
286286
/// This is for simplicity, and because we are not really smart
287287
/// enough to cope with such bounds anywhere.
288-
pubfndeclared_bounds_from_definition(
288+
pub(crate)fndeclared_bounds_from_definition(
289289
&self,
290290
alias_ty: ty::AliasTy<'tcx>,
291291
) -> implIterator<Item = ty::Region<'tcx>>{

‎compiler/rustc_infer/src/infer/region_constraints/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub struct RegionVariableInfo {
304304
pubuniverse: ty::UniverseIndex,
305305
}
306306

307-
pubstructRegionSnapshot{
307+
pub(crate)structRegionSnapshot{
308308
any_unifications:bool,
309309
}
310310

‎compiler/rustc_infer/src/infer/relate/combine.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace, relate};
3333
usecrate::traits::{Obligation,PredicateObligation};
3434

3535
#[derive(Clone)]
36-
pubstructCombineFields<'infcx,'tcx>{
36+
pub(crate)structCombineFields<'infcx,'tcx>{
3737
pubinfcx:&'infcxInferCtxt<'tcx>,
3838
// Immutable fields
3939
pubtrace:TypeTrace<'tcx>,
@@ -47,7 +47,7 @@ pub struct CombineFields<'infcx, 'tcx> {
4747
}
4848

4949
impl<'infcx,'tcx>CombineFields<'infcx,'tcx>{
50-
pubfnnew(
50+
pub(crate)fnnew(
5151
infcx:&'infcxInferCtxt<'tcx>,
5252
trace:TypeTrace<'tcx>,
5353
param_env: ty::ParamEnv<'tcx>,
@@ -283,22 +283,22 @@ impl<'tcx> InferCtxt<'tcx> {
283283
}
284284

285285
impl<'infcx,'tcx>CombineFields<'infcx,'tcx>{
286-
pubfntcx(&self) -> TyCtxt<'tcx>{
286+
pub(crate)fntcx(&self) -> TyCtxt<'tcx>{
287287
self.infcx.tcx
288288
}
289289

290-
pubfnequate<'a>(
290+
pub(crate)fnequate<'a>(
291291
&'amutself,
292292
structurally_relate_aliases:StructurallyRelateAliases,
293293
) -> TypeRelating<'a,'infcx,'tcx>{
294294
TypeRelating::new(self, structurally_relate_aliases, ty::Invariant)
295295
}
296296

297-
pubfnsub<'a>(&'amutself) -> TypeRelating<'a,'infcx,'tcx>{
297+
pub(crate)fnsub<'a>(&'amutself) -> TypeRelating<'a,'infcx,'tcx>{
298298
TypeRelating::new(self,StructurallyRelateAliases::No, ty::Covariant)
299299
}
300300

301-
pubfnsup<'a>(&'amutself) -> TypeRelating<'a,'infcx,'tcx>{
301+
pub(crate)fnsup<'a>(&'amutself) -> TypeRelating<'a,'infcx,'tcx>{
302302
TypeRelating::new(self,StructurallyRelateAliases::No, ty::Contravariant)
303303
}
304304

@@ -310,14 +310,14 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
310310
LatticeOp::new(self,LatticeOpKind::Glb)
311311
}
312312

313-
pubfnregister_obligations(
313+
pub(crate)fnregister_obligations(
314314
&mutself,
315315
obligations:implIntoIterator<Item = Goal<'tcx, ty::Predicate<'tcx>>>,
316316
){
317317
self.goals.extend(obligations);
318318
}
319319

320-
pubfnregister_predicates(
320+
pub(crate)fnregister_predicates(
321321
&mutself,
322322
obligations:implIntoIterator<Item:Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>>,
323323
){

‎compiler/rustc_infer/src/infer/relate/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
pubuse rustc_middle::ty::relate::RelateResult;
66
pubuse rustc_next_trait_solver::relate::*;
77

8-
pubuseself::combine::{CombineFields,PredicateEmittingRelation};
8+
pubuseself::combine::PredicateEmittingRelation;
99

1010
#[allow(hidden_glob_reexports)]
1111
pub(super)mod combine;

‎compiler/rustc_infer/src/infer/relate/type_relating.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::infer::relate::{PredicateEmittingRelation, StructurallyRelateAliases}
1313
usecrate::infer::{DefineOpaqueTypes,InferCtxt,SubregionOrigin};
1414

1515
/// Enforce that `a` is equal to or a subtype of `b`.
16-
pubstructTypeRelating<'combine,'a,'tcx>{
16+
pub(crate)structTypeRelating<'combine,'a,'tcx>{
1717
// Immutable except for the `InferCtxt` and the
1818
// resulting nested `goals`.
1919
fields:&'combinemutCombineFields<'a,'tcx>,
@@ -49,7 +49,7 @@ pub struct TypeRelating<'combine, 'a, 'tcx> {
4949
}
5050

5151
impl<'combine,'infcx,'tcx>TypeRelating<'combine,'infcx,'tcx>{
52-
pubfnnew(
52+
pub(crate)fnnew(
5353
f:&'combinemutCombineFields<'infcx,'tcx>,
5454
structurally_relate_aliases:StructurallyRelateAliases,
5555
ambient_variance: ty::Variance,

‎compiler/rustc_infer/src/infer/snapshot/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use tracing::{debug, instrument};
55
usesuper::InferCtxt;
66
usesuper::region_constraints::RegionSnapshot;
77

8-
mod fudge;
8+
pub(crate)mod fudge;
99
pub(crate)mod undo_log;
1010

1111
use undo_log::{Snapshot,UndoLog};

0 commit comments

Comments
 (0)