diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs index b2df2777987..58f6eaf25ce 100644 --- a/src/abi/pass_mode.rs +++ b/src/abi/pass_mode.rs @@ -1,5 +1,7 @@ use crate::prelude::*; +pub(super) use EmptySinglePair::*; + #[derive(Copy, Clone, Debug)] pub enum PassMode { NoPass, @@ -9,18 +11,18 @@ pub enum PassMode { } #[derive(Copy, Clone, Debug)] -pub enum EmptySinglePair { +pub(super) enum EmptySinglePair { Empty, Single(T), Pair(T, T), } impl EmptySinglePair { - pub fn into_iter(self) -> EmptySinglePairIter { + pub(super) fn into_iter(self) -> EmptySinglePairIter { EmptySinglePairIter(self) } - pub fn map(self, mut f: impl FnMut(T) -> U) -> EmptySinglePair { + pub(super) fn map(self, mut f: impl FnMut(T) -> U) -> EmptySinglePair { match self { Empty => Empty, Single(v) => Single(f(v)), @@ -29,7 +31,7 @@ impl EmptySinglePair { } } -pub struct EmptySinglePairIter(EmptySinglePair); +pub(super) struct EmptySinglePairIter(EmptySinglePair); impl Iterator for EmptySinglePairIter { type Item = T; @@ -47,14 +49,14 @@ impl Iterator for EmptySinglePairIter { } impl EmptySinglePair { - pub fn assert_single(self) -> T { + pub(super) fn assert_single(self) -> T { match self { Single(v) => v, _ => panic!("Called assert_single on {:?}", self), } } - pub fn assert_pair(self) -> (T, T) { + pub(super) fn assert_pair(self) -> (T, T) { match self { Pair(a, b) => (a, b), _ => panic!("Called assert_pair on {:?}", self), @@ -62,10 +64,8 @@ impl EmptySinglePair { } } -pub use EmptySinglePair::*; - impl PassMode { - pub fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair { + pub(super) fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair { match self { PassMode::NoPass => Empty, PassMode::ByVal(clif_type) => Single(clif_type), @@ -108,7 +108,7 @@ pub fn get_pass_mode<'tcx>(tcx: TyCtxt<'tcx>, layout: TyLayout<'tcx>) -> PassMod } } -pub fn adjust_arg_for_abi<'tcx>( +pub(super) fn adjust_arg_for_abi<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, arg: CValue<'tcx>, ) -> EmptySinglePair { @@ -123,7 +123,7 @@ pub fn adjust_arg_for_abi<'tcx>( } } -pub fn cvalue_for_param<'tcx>( +pub(super) fn cvalue_for_param<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, start_ebb: Ebb, local: Option, diff --git a/src/abi/returning.rs b/src/abi/returning.rs index f0a36e193b2..5228eb6031b 100644 --- a/src/abi/returning.rs +++ b/src/abi/returning.rs @@ -13,7 +13,7 @@ pub fn can_return_to_ssa_var<'tcx>(tcx: TyCtxt<'tcx>, dest_layout: TyLayout<'tcx } } -pub fn codegen_return_param( +pub(super) fn codegen_return_param( fx: &mut FunctionCx, ssa_analyzed: &rustc_index::vec::IndexVec, start_ebb: Ebb, @@ -54,7 +54,7 @@ pub fn codegen_return_param( ); } -pub fn codegen_with_call_return_arg<'tcx, B: Backend, T>( +pub(super) fn codegen_with_call_return_arg<'tcx, B: Backend, T>( fx: &mut FunctionCx<'_, 'tcx, B>, fn_sig: FnSig<'tcx>, ret_place: Option>, diff --git a/src/allocator.rs b/src/allocator.rs index cfcb091afb5..df9e6aa1962 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -28,7 +28,7 @@ pub fn codegen(tcx: TyCtxt<'_>, module: &mut Module) -> } } -pub fn codegen_inner(module: &mut Module, kind: AllocatorKind) { +fn codegen_inner(module: &mut Module, kind: AllocatorKind) { let usize_ty = module.target_config().pointer_type(); for method in ALLOCATOR_METHODS { diff --git a/src/common.rs b/src/common.rs index 201467c62a0..dcf47f6657a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -34,7 +34,7 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type { } } -pub fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option { +fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option { Some(match ty.kind { ty::Bool => types::I8, ty::Uint(size) => match size { diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index 107ab6b763d..3152e4812f7 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -101,7 +101,7 @@ impl<'tcx> DebugContext<'tcx> { } impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> { - pub(crate) fn create_debug_lines( + pub(super) fn create_debug_lines( &mut self, context: &Context, isa: &dyn cranelift_codegen::isa::TargetIsa, diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 0aab46b3bf0..70c9167c69e 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -127,7 +127,7 @@ macro atomic_minmax($fx:expr, $cc:expr, <$T:ident> ($ptr:ident, $src:ident) -> $ $ret.write_cvalue($fx, ret_val); } -pub fn lane_type_and_count<'tcx>( +fn lane_type_and_count<'tcx>( tcx: TyCtxt<'tcx>, layout: TyLayout<'tcx>, ) -> (TyLayout<'tcx>, u32) { diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index cd163aa7ed3..04e55d80187 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -1,7 +1,7 @@ use crate::prelude::*; use super::*; -pub fn codegen_simd_intrinsic_call<'tcx>( +pub(super) fn codegen_simd_intrinsic_call<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, instance: Instance<'tcx>, args: &[mir::Operand<'tcx>], diff --git a/src/optimize/code_layout.rs b/src/optimize/code_layout.rs index 947b61d42e0..4d2301c6f6c 100644 --- a/src/optimize/code_layout.rs +++ b/src/optimize/code_layout.rs @@ -10,7 +10,7 @@ use crate::prelude::*; -pub fn optimize_function(ctx: &mut Context, cold_ebbs: &EntitySet) { +pub(super) fn optimize_function(ctx: &mut Context, cold_ebbs: &EntitySet) { // FIXME Move the ebb in place instead of remove and append once // bytecodealliance/cranelift#1339 is implemented.