Reduce exposure of some items.

This commit is contained in:
Nicholas Nethercote 2023-11-16 17:08:27 +11:00
parent 290fc68f2d
commit e2664eba50
11 changed files with 16 additions and 16 deletions

View File

@ -16,7 +16,7 @@ use rustc_target::spec::abi::Abi as SpecAbi;
use std::iter; use std::iter;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { fn_abi_of_fn_ptr, fn_abi_of_instance, ..*providers }; *providers = Providers { fn_abi_of_fn_ptr, fn_abi_of_instance, ..*providers };
} }

View File

@ -8,7 +8,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::{self, GenericArgs, ImplTraitInTraitData, Ty, TyCtxt}; use rustc_middle::ty::{self, GenericArgs, ImplTraitInTraitData, Ty, TyCtxt};
use rustc_span::symbol::kw; use rustc_span::symbol::kw;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { *providers = Providers {
associated_item, associated_item,
associated_item_def_ids, associated_item_def_ids,

View File

@ -17,7 +17,7 @@ use crate::errors::{GenericConstantTooComplex, GenericConstantTooComplexSub};
/// Destructures array, ADT or tuple constants into the constants /// Destructures array, ADT or tuple constants into the constants
/// of their fields. /// of their fields.
pub(crate) fn destructure_const<'tcx>( fn destructure_const<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
const_: ty::Const<'tcx>, const_: ty::Const<'tcx>,
) -> ty::DestructuredConst<'tcx> { ) -> ty::DestructuredConst<'tcx> {
@ -396,7 +396,7 @@ impl<'a, 'tcx> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
} }
/// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead. /// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead.
pub fn thir_abstract_const( fn thir_abstract_const(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
def: LocalDefId, def: LocalDefId,
) -> Result<Option<ty::EarlyBinder<ty::Const<'_>>>, ErrorGuaranteed> { ) -> Result<Option<ty::EarlyBinder<ty::Const<'_>>>, ErrorGuaranteed> {
@ -428,6 +428,6 @@ pub fn thir_abstract_const(
Ok(Some(ty::EarlyBinder::bind(recurse_build(tcx, body, body_id, root_span)?))) Ok(Some(ty::EarlyBinder::bind(recurse_build(tcx, body, body_id, root_span)?)))
} }
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { destructure_const, thir_abstract_const, ..*providers }; *providers = Providers { destructure_const, thir_abstract_const, ..*providers };
} }

View File

@ -7,7 +7,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::Span; use rustc_span::Span;
use std::iter; use std::iter;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { *providers = Providers {
assumed_wf_types, assumed_wf_types,
assumed_wf_types_for_rpitit: |tcx, def_id| { assumed_wf_types_for_rpitit: |tcx, def_id| {

View File

@ -328,6 +328,6 @@ fn resolve_associated_item<'tcx>(
}) })
} }
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { resolve_instance, ..*providers }; *providers = Providers { resolve_instance, ..*providers };
} }

View File

@ -24,7 +24,7 @@ use crate::errors::{
}; };
use crate::layout_sanity_check::sanity_check_layout; use crate::layout_sanity_check::sanity_check_layout;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { layout_of, ..*providers }; *providers = Providers { layout_of, ..*providers };
} }

View File

@ -34,13 +34,13 @@ mod common_traits;
mod consts; mod consts;
mod errors; mod errors;
mod implied_bounds; mod implied_bounds;
pub mod instance; mod instance;
mod layout; mod layout;
mod layout_sanity_check; mod layout_sanity_check;
mod needs_drop; mod needs_drop;
mod opaque_types; mod opaque_types;
pub mod representability; mod representability;
pub mod sig_types; mod sig_types;
mod structural_match; mod structural_match;
mod ty; mod ty;

View File

@ -6,7 +6,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::{self, Representability, Ty, TyCtxt}; use rustc_middle::ty::{self, Representability, Ty, TyCtxt};
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = *providers =
Providers { representability, representability_adt_ty, params_in_repr, ..*providers }; Providers { representability, representability_adt_ty, params_in_repr, ..*providers };
} }

View File

@ -8,7 +8,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_span::Span; use rustc_span::Span;
use rustc_type_ir::visit::TypeVisitable; use rustc_type_ir::visit::TypeVisitable;
pub trait SpannedTypeVisitor<'tcx> { pub(crate) trait SpannedTypeVisitor<'tcx> {
type BreakTy = !; type BreakTy = !;
fn visit( fn visit(
&mut self, &mut self,
@ -17,7 +17,7 @@ pub trait SpannedTypeVisitor<'tcx> {
) -> ControlFlow<Self::BreakTy>; ) -> ControlFlow<Self::BreakTy>;
} }
pub fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>( pub(crate) fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
item: LocalDefId, item: LocalDefId,
visitor: &mut V, visitor: &mut V,

View File

@ -39,6 +39,6 @@ fn has_structural_eq_impls<'tcx>(tcx: TyCtxt<'tcx>, adt_ty: Ty<'tcx>) -> bool {
ocx.select_all_or_error().is_empty() ocx.select_all_or_error().is_empty()
} }
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
providers.has_structural_eq_impls = has_structural_eq_impls; providers.has_structural_eq_impls = has_structural_eq_impls;
} }

View File

@ -351,7 +351,7 @@ fn unsizing_params_for_adt<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BitSet<u32
unsizing_params unsizing_params
} }
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { *providers = Providers {
asyncness, asyncness,
adt_sized_constraint, adt_sized_constraint,