diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 7cfb101399daa..8be327a8b5647 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -46,7 +46,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> { /// Returns `true` if `local` is `NeedsDrop` at the given `Location`. /// /// Only updates the cursor if absolutely necessary - pub fn needs_drop( + fn needs_drop( &mut self, ccx: &'mir ConstCx<'mir, 'tcx>, local: Local, @@ -76,7 +76,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> { /// Returns `true` if `local` is `NeedsNonConstDrop` at the given `Location`. /// /// Only updates the cursor if absolutely necessary - pub fn needs_non_const_drop( + pub(crate) fn needs_non_const_drop( &mut self, ccx: &'mir ConstCx<'mir, 'tcx>, local: Local, @@ -106,7 +106,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> { /// Returns `true` if `local` is `HasMutInterior` at the given `Location`. /// /// Only updates the cursor if absolutely necessary. - pub fn has_mut_interior( + fn has_mut_interior( &mut self, ccx: &'mir ConstCx<'mir, 'tcx>, local: Local, diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index 93fafa6055773..e8f10c88408ba 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -57,7 +57,7 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug { /// A function call where the callee is a pointer. #[derive(Debug)] -pub struct FnCallIndirect; +pub(crate) struct FnCallIndirect; impl<'tcx> NonConstOp<'tcx> for FnCallIndirect { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::UnallowedFnPointerCall { span, kind: ccx.const_kind() }) @@ -66,7 +66,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect { /// A function call where the callee is not marked as `const`. #[derive(Debug, Clone, Copy)] -pub struct FnCallNonConst<'tcx> { +pub(crate) struct FnCallNonConst<'tcx> { pub caller: LocalDefId, pub callee: DefId, pub args: GenericArgsRef<'tcx>, @@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { /// /// Contains the name of the feature that would allow the use of this function. #[derive(Debug)] -pub struct FnCallUnstable(pub DefId, pub Option); +pub(crate) struct FnCallUnstable(pub DefId, pub Option); impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { @@ -324,7 +324,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { } #[derive(Debug)] -pub struct Coroutine(pub hir::CoroutineKind); +pub(crate) struct Coroutine(pub hir::CoroutineKind); impl<'tcx> NonConstOp<'tcx> for Coroutine { fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status { if let hir::CoroutineKind::Desugared( @@ -356,7 +356,7 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine { } #[derive(Debug)] -pub struct HeapAllocation; +pub(crate) struct HeapAllocation; impl<'tcx> NonConstOp<'tcx> for HeapAllocation { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::UnallowedHeapAllocations { @@ -368,7 +368,7 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation { } #[derive(Debug)] -pub struct InlineAsm; +pub(crate) struct InlineAsm; impl<'tcx> NonConstOp<'tcx> for InlineAsm { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::UnallowedInlineAsm { span, kind: ccx.const_kind() }) @@ -376,7 +376,7 @@ impl<'tcx> NonConstOp<'tcx> for InlineAsm { } #[derive(Debug)] -pub struct LiveDrop<'tcx> { +pub(crate) struct LiveDrop<'tcx> { pub dropped_at: Option, pub dropped_ty: Ty<'tcx>, } @@ -394,7 +394,7 @@ impl<'tcx> NonConstOp<'tcx> for LiveDrop<'tcx> { #[derive(Debug)] /// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow never escapes to /// the final value of the constant. -pub struct TransientCellBorrow; +pub(crate) struct TransientCellBorrow; impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow { fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status { Status::Unstable(sym::const_refs_to_cell) @@ -410,7 +410,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow { /// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow might escape to /// the final value of the constant, and thus we cannot allow this (for now). We may allow /// it in the future for static items. -pub struct CellBorrow; +pub(crate) struct CellBorrow; impl<'tcx> NonConstOp<'tcx> for CellBorrow { fn importance(&self) -> DiagImportance { // Most likely the code will try to do mutation with these borrows, which @@ -431,7 +431,7 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow { /// This op is for `&mut` borrows in the trailing expression of a constant /// which uses the "enclosing scopes rule" to leak its locals into anonymous /// static or const items. -pub struct MutBorrow(pub hir::BorrowKind); +pub(crate) struct MutBorrow(pub hir::BorrowKind); impl<'tcx> NonConstOp<'tcx> for MutBorrow { fn status_in_item(&self, _ccx: &ConstCx<'_, 'tcx>) -> Status { @@ -461,7 +461,7 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow { } #[derive(Debug)] -pub struct TransientMutBorrow(pub hir::BorrowKind); +pub(crate) struct TransientMutBorrow(pub hir::BorrowKind); impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow { fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status { @@ -484,7 +484,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow { } #[derive(Debug)] -pub struct MutDeref; +pub(crate) struct MutDeref; impl<'tcx> NonConstOp<'tcx> for MutDeref { fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status { Status::Unstable(sym::const_mut_refs) @@ -505,7 +505,7 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref { /// A call to a `panic()` lang item where the first argument is _not_ a `&str`. #[derive(Debug)] -pub struct PanicNonStr; +pub(crate) struct PanicNonStr; impl<'tcx> NonConstOp<'tcx> for PanicNonStr { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::PanicNonStrErr { span }) @@ -516,7 +516,7 @@ impl<'tcx> NonConstOp<'tcx> for PanicNonStr { /// Not currently intended to ever be allowed, even behind a feature gate: operation depends on /// allocation base addresses that are not known at compile-time. #[derive(Debug)] -pub struct RawPtrComparison; +pub(crate) struct RawPtrComparison; impl<'tcx> NonConstOp<'tcx> for RawPtrComparison { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { // FIXME(const_trait_impl): revert to span_bug? @@ -525,7 +525,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrComparison { } #[derive(Debug)] -pub struct RawMutPtrDeref; +pub(crate) struct RawMutPtrDeref; impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref { fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status { Status::Unstable(sym::const_mut_refs) @@ -546,7 +546,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref { /// Not currently intended to ever be allowed, even behind a feature gate: operation depends on /// allocation base addresses that are not known at compile-time. #[derive(Debug)] -pub struct RawPtrToIntCast; +pub(crate) struct RawPtrToIntCast; impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::RawPtrToIntErr { span }) @@ -555,7 +555,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast { /// An access to a (non-thread-local) `static`. #[derive(Debug)] -pub struct StaticAccess; +pub(crate) struct StaticAccess; impl<'tcx> NonConstOp<'tcx> for StaticAccess { fn status_in_item(&self, ccx: &ConstCx<'_, 'tcx>) -> Status { if let hir::ConstContext::Static(_) = ccx.const_kind() { @@ -582,7 +582,7 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess { /// An access to a thread-local `static`. #[derive(Debug)] -pub struct ThreadLocalAccess; +pub(crate) struct ThreadLocalAccess; impl<'tcx> NonConstOp<'tcx> for ThreadLocalAccess { fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> { ccx.dcx().create_err(errors::ThreadLocalAccessErr { span }) @@ -590,11 +590,11 @@ impl<'tcx> NonConstOp<'tcx> for ThreadLocalAccess { } /// Types that cannot appear in the signature or locals of a `const fn`. -pub mod mut_ref { +pub(crate) mod mut_ref { use super::*; #[derive(Debug)] - pub struct MutRef(pub mir::LocalKind); + pub(crate) struct MutRef(pub mir::LocalKind); impl<'tcx> NonConstOp<'tcx> for MutRef { fn status_in_item(&self, _ccx: &ConstCx<'_, 'tcx>) -> Status { Status::Unstable(sym::const_mut_refs) diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index d7d033e516295..840f7986c6e0a 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -61,13 +61,13 @@ pub(super) struct MemPlace { impl MemPlace { /// Adjust the provenance of the main pointer (metadata is unaffected). - pub fn map_provenance(self, f: impl FnOnce(Prov) -> Prov) -> Self { + fn map_provenance(self, f: impl FnOnce(Prov) -> Prov) -> Self { MemPlace { ptr: self.ptr.map_provenance(|p| p.map(f)), ..self } } /// Turn a mplace into a (thin or wide) pointer, as a reference, pointing to the same space. #[inline] - pub fn to_ref(self, cx: &impl HasDataLayout) -> Immediate { + fn to_ref(self, cx: &impl HasDataLayout) -> Immediate { Immediate::new_pointer_with_meta(self.ptr, self.meta, cx) } diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index d825a47bfdf5d..73dda81bd298b 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -14,6 +14,7 @@ #![feature(trait_alias)] #![feature(try_blocks)] #![feature(yeet_expr)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub mod check_consts; diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs index a4e4f50e8f2d4..45057a3530c3e 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs @@ -26,11 +26,11 @@ use crate::cfi::typeid::itanium_cxx_abi::transform::{TransformTy, TransformTyOpt use crate::cfi::typeid::TypeIdOptions; /// Options for encode_ty. -pub type EncodeTyOptions = TypeIdOptions; +pub(crate) type EncodeTyOptions = TypeIdOptions; /// Substitution dictionary key. #[derive(Eq, Hash, PartialEq)] -pub enum DictKey<'tcx> { +pub(crate) enum DictKey<'tcx> { Ty(Ty<'tcx>, TyQ), Region(Region<'tcx>), Const(Const<'tcx>), @@ -39,7 +39,7 @@ pub enum DictKey<'tcx> { /// Type and extended type qualifiers. #[derive(Eq, Hash, PartialEq)] -pub enum TyQ { +pub(crate) enum TyQ { None, Const, Mut, diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index 5b2062e0b0ab3..34763adde4f0a 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs @@ -23,16 +23,16 @@ use crate::cfi::typeid::itanium_cxx_abi::encode::EncodeTyOptions; use crate::cfi::typeid::TypeIdOptions; /// Options for transform_ty. -pub type TransformTyOptions = TypeIdOptions; +pub(crate) type TransformTyOptions = TypeIdOptions; -pub struct TransformTy<'tcx> { +pub(crate) struct TransformTy<'tcx> { tcx: TyCtxt<'tcx>, options: TransformTyOptions, parents: Vec>, } impl<'tcx> TransformTy<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self { + pub(crate) fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self { TransformTy { tcx, options, parents: Vec::new() } } } diff --git a/compiler/rustc_sanitizers/src/lib.rs b/compiler/rustc_sanitizers/src/lib.rs index e4792563e71ea..55be931bcd6d4 100644 --- a/compiler/rustc_sanitizers/src/lib.rs +++ b/compiler/rustc_sanitizers/src/lib.rs @@ -5,6 +5,7 @@ // tidy-alphabetical-start #![feature(let_chains)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub mod cfi; diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index f0e1630c65009..b7977a848ce00 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -16,6 +16,7 @@ #![feature(never_type)] #![feature(ptr_sub_ptr)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub use self::serialize::{Decodable, Decoder, Encodable, Encoder}; diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index d93b3eac08040..7e059a88c2790 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -5,6 +5,7 @@ #![feature(map_many_mut)] #![feature(option_get_or_insert_default)] #![feature(rustc_attrs)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub mod errors; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 37077901e0c34..45339c23ea3ef 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -358,94 +358,98 @@ fn build_options( #[allow(non_upper_case_globals)] mod desc { - pub const parse_no_flag: &str = "no value"; - pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`"; - pub const parse_opt_bool: &str = parse_bool; - pub const parse_string: &str = "a string"; - pub const parse_opt_string: &str = parse_string; - pub const parse_string_push: &str = parse_string; - pub const parse_opt_langid: &str = "a language identifier"; - pub const parse_opt_pathbuf: &str = "a path"; - pub const parse_list: &str = "a space-separated list of strings"; - pub const parse_list_with_polarity: &str = + pub(crate) const parse_no_flag: &str = "no value"; + pub(crate) const parse_bool: &str = + "one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`"; + pub(crate) const parse_opt_bool: &str = parse_bool; + pub(crate) const parse_string: &str = "a string"; + pub(crate) const parse_opt_string: &str = parse_string; + pub(crate) const parse_string_push: &str = parse_string; + pub(crate) const parse_opt_langid: &str = "a language identifier"; + pub(crate) const parse_opt_pathbuf: &str = "a path"; + pub(crate) const parse_list: &str = "a space-separated list of strings"; + pub(crate) const parse_list_with_polarity: &str = "a comma-separated list of strings, with elements beginning with + or -"; - pub const parse_comma_list: &str = "a comma-separated list of strings"; - pub const parse_opt_comma_list: &str = parse_comma_list; - pub const parse_number: &str = "a number"; - pub const parse_opt_number: &str = parse_number; - pub const parse_frame_pointer: &str = "one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf` or `always`"; - pub const parse_threads: &str = parse_number; - pub const parse_time_passes_format: &str = "`text` (default) or `json`"; - pub const parse_passes: &str = "a space-separated list of passes, or `all`"; - pub const parse_panic_strategy: &str = "either `unwind` or `abort`"; - pub const parse_on_broken_pipe: &str = "either `kill`, `error`, or `inherit`"; - pub const parse_patchable_function_entry: &str = "either two comma separated integers (total_nops,prefix_nops), with prefix_nops <= total_nops, or one integer (total_nops)"; - pub const parse_opt_panic_strategy: &str = parse_panic_strategy; - pub const parse_oom_strategy: &str = "either `panic` or `abort`"; - pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`"; - pub const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `dataflow`, `hwaddress`, `kcfi`, `kernel-address`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, or `thread`"; - pub const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2"; - pub const parse_cfguard: &str = + pub(crate) const parse_comma_list: &str = "a comma-separated list of strings"; + pub(crate) const parse_opt_comma_list: &str = parse_comma_list; + pub(crate) const parse_number: &str = "a number"; + pub(crate) const parse_opt_number: &str = parse_number; + pub(crate) const parse_frame_pointer: &str = "one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf` or `always`"; + pub(crate) const parse_threads: &str = parse_number; + pub(crate) const parse_time_passes_format: &str = "`text` (default) or `json`"; + pub(crate) const parse_passes: &str = "a space-separated list of passes, or `all`"; + pub(crate) const parse_panic_strategy: &str = "either `unwind` or `abort`"; + pub(crate) const parse_on_broken_pipe: &str = "either `kill`, `error`, or `inherit`"; + pub(crate) const parse_patchable_function_entry: &str = "either two comma separated integers (total_nops,prefix_nops), with prefix_nops <= total_nops, or one integer (total_nops)"; + pub(crate) const parse_opt_panic_strategy: &str = parse_panic_strategy; + pub(crate) const parse_oom_strategy: &str = "either `panic` or `abort`"; + pub(crate) const parse_relro_level: &str = "one of: `full`, `partial`, or `off`"; + pub(crate) const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `dataflow`, `hwaddress`, `kcfi`, `kernel-address`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, or `thread`"; + pub(crate) const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2"; + pub(crate) const parse_cfguard: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), `checks`, or `nochecks`"; - pub const parse_cfprotection: &str = "`none`|`no`|`n` (default), `branch`, `return`, or `full`|`yes`|`y` (equivalent to `branch` and `return`)"; - pub const parse_debuginfo: &str = "either an integer (0, 1, 2), `none`, `line-directives-only`, `line-tables-only`, `limited`, or `full`"; - pub const parse_debuginfo_compression: &str = "one of `none`, `zlib`, or `zstd`"; - pub const parse_collapse_macro_debuginfo: &str = "one of `no`, `external`, or `yes`"; - pub const parse_strip: &str = "either `none`, `debuginfo`, or `symbols`"; - pub const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of(); - pub const parse_optimization_fuel: &str = "crate=integer"; - pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`"; - pub const parse_instrument_coverage: &str = parse_bool; - pub const parse_coverage_options: &str = + pub(crate) const parse_cfprotection: &str = "`none`|`no`|`n` (default), `branch`, `return`, or `full`|`yes`|`y` (equivalent to `branch` and `return`)"; + pub(crate) const parse_debuginfo: &str = "either an integer (0, 1, 2), `none`, `line-directives-only`, `line-tables-only`, `limited`, or `full`"; + pub(crate) const parse_debuginfo_compression: &str = "one of `none`, `zlib`, or `zstd`"; + pub(crate) const parse_collapse_macro_debuginfo: &str = "one of `no`, `external`, or `yes`"; + pub(crate) const parse_strip: &str = "either `none`, `debuginfo`, or `symbols`"; + pub(crate) const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of(); + pub(crate) const parse_optimization_fuel: &str = "crate=integer"; + pub(crate) const parse_dump_mono_stats: &str = "`markdown` (default) or `json`"; + pub(crate) const parse_instrument_coverage: &str = parse_bool; + pub(crate) const parse_coverage_options: &str = "`block` | `branch` | `condition` | `mcdc` | `no-mir-spans`"; - pub const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; - pub const parse_unpretty: &str = "`string` or `string=string`"; - pub const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; - pub const parse_next_solver_config: &str = + pub(crate) const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; + pub(crate) const parse_unpretty: &str = "`string` or `string=string`"; + pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; + pub(crate) const parse_next_solver_config: &str = "a comma separated list of solver configurations: `globally` (default), and `coherence`"; - pub const parse_lto: &str = + pub(crate) const parse_lto: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted"; - pub const parse_linker_plugin_lto: &str = + pub(crate) const parse_linker_plugin_lto: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or the path to the linker plugin"; - pub const parse_location_detail: &str = "either `none`, or a comma separated list of location details to track: `file`, `line`, or `column`"; - pub const parse_fmt_debug: &str = "either `full`, `shallow`, or `none`"; - pub const parse_switch_with_opt_path: &str = + pub(crate) const parse_location_detail: &str = "either `none`, or a comma separated list of location details to track: `file`, `line`, or `column`"; + pub(crate) const parse_fmt_debug: &str = "either `full`, `shallow`, or `none`"; + pub(crate) const parse_switch_with_opt_path: &str = "an optional path to the profiling data output directory"; - pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`"; - pub const parse_symbol_mangling_version: &str = + pub(crate) const parse_merge_functions: &str = + "one of: `disabled`, `trampolines`, or `aliases`"; + pub(crate) const parse_symbol_mangling_version: &str = "one of: `legacy`, `v0` (RFC 2603), or `hashed`"; - pub const parse_src_file_hash: &str = "either `md5` or `sha1`"; - pub const parse_relocation_model: &str = + pub(crate) const parse_src_file_hash: &str = "either `md5` or `sha1`"; + pub(crate) const parse_relocation_model: &str = "one of supported relocation models (`rustc --print relocation-models`)"; - pub const parse_code_model: &str = "one of supported code models (`rustc --print code-models`)"; - pub const parse_tls_model: &str = "one of supported TLS models (`rustc --print tls-models`)"; - pub const parse_target_feature: &str = parse_string; - pub const parse_terminal_url: &str = + pub(crate) const parse_code_model: &str = + "one of supported code models (`rustc --print code-models`)"; + pub(crate) const parse_tls_model: &str = + "one of supported TLS models (`rustc --print tls-models`)"; + pub(crate) const parse_target_feature: &str = parse_string; + pub(crate) const parse_terminal_url: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or `auto`"; - pub const parse_wasi_exec_model: &str = "either `command` or `reactor`"; - pub const parse_split_debuginfo: &str = + pub(crate) const parse_wasi_exec_model: &str = "either `command` or `reactor`"; + pub(crate) const parse_split_debuginfo: &str = "one of supported split-debuginfo modes (`off`, `packed`, or `unpacked`)"; - pub const parse_split_dwarf_kind: &str = + pub(crate) const parse_split_dwarf_kind: &str = "one of supported split dwarf modes (`split` or `single`)"; - pub const parse_link_self_contained: &str = "one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) \ + pub(crate) const parse_link_self_contained: &str = "one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) \ components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw`"; - pub const parse_linker_features: &str = + pub(crate) const parse_linker_features: &str = "a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld`"; - pub const parse_polonius: &str = "either no value or `legacy` (the default), or `next`"; - pub const parse_stack_protector: &str = + pub(crate) const parse_polonius: &str = "either no value or `legacy` (the default), or `next`"; + pub(crate) const parse_stack_protector: &str = "one of (`none` (default), `basic`, `strong`, or `all`)"; - pub const parse_branch_protection: &str = + pub(crate) const parse_branch_protection: &str = "a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`"; - pub const parse_proc_macro_execution_strategy: &str = + pub(crate) const parse_proc_macro_execution_strategy: &str = "one of supported execution strategies (`same-thread`, or `cross-thread`)"; - pub const parse_remap_path_scope: &str = + pub(crate) const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `debuginfo`, `object`, `all`"; - pub const parse_inlining_threshold: &str = + pub(crate) const parse_inlining_threshold: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number"; - pub const parse_llvm_module_flag: &str = ":::. Type must currently be `u32`. Behavior should be one of (`error`, `warning`, `require`, `override`, `append`, `appendunique`, `max`, `min`)"; - pub const parse_function_return: &str = "`keep` or `thunk-extern`"; - pub const parse_wasm_c_abi: &str = "`legacy` or `spec`"; - pub const parse_mir_include_spans: &str = + pub(crate) const parse_llvm_module_flag: &str = ":::. Type must currently be `u32`. Behavior should be one of (`error`, `warning`, `require`, `override`, `append`, `appendunique`, `max`, `min`)"; + pub(crate) const parse_function_return: &str = "`keep` or `thunk-extern`"; + pub(crate) const parse_wasm_c_abi: &str = "`legacy` or `spec`"; + pub(crate) const parse_mir_include_spans: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or `nll` (default: `nll`)"; } diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_smir/src/lib.rs index 9f88887530614..2215e2f01ade0 100644 --- a/compiler/rustc_smir/src/lib.rs +++ b/compiler/rustc_smir/src/lib.rs @@ -15,6 +15,7 @@ )] #![doc(rust_logo)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub mod rustc_internal; diff --git a/compiler/rustc_smir/src/rustc_smir/alloc.rs b/compiler/rustc_smir/src/rustc_smir/alloc.rs index 677b4c7a9c0e3..11fbc005e37da 100644 --- a/compiler/rustc_smir/src/rustc_smir/alloc.rs +++ b/compiler/rustc_smir/src/rustc_smir/alloc.rs @@ -20,7 +20,7 @@ fn new_empty_allocation(align: rustc_target::abi::Align) -> Allocation { // because we need to get `Ty` of the const we are trying to create, to do that // we need to have access to `ConstantKind` but we can't access that inside Stable impl. #[allow(rustc::usage_of_qualified_ty)] -pub fn new_allocation<'tcx>( +pub(crate) fn new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, const_value: ConstValue<'tcx>, tables: &mut Tables<'tcx>, @@ -30,7 +30,7 @@ pub fn new_allocation<'tcx>( } #[allow(rustc::usage_of_qualified_ty)] -pub fn try_new_allocation<'tcx>( +pub(crate) fn try_new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, const_value: ConstValue<'tcx>, tables: &mut Tables<'tcx>, diff --git a/compiler/rustc_smir/src/rustc_smir/builder.rs b/compiler/rustc_smir/src/rustc_smir/builder.rs index 883ab7c18b485..cd91fc26c1018 100644 --- a/compiler/rustc_smir/src/rustc_smir/builder.rs +++ b/compiler/rustc_smir/src/rustc_smir/builder.rs @@ -12,13 +12,13 @@ use rustc_middle::ty::{self, TyCtxt}; use crate::rustc_smir::{Stable, Tables}; /// Builds a monomorphic body for a given instance. -pub struct BodyBuilder<'tcx> { +pub(crate) struct BodyBuilder<'tcx> { tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>, } impl<'tcx> BodyBuilder<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self { + pub(crate) fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self { let instance = match instance.def { // To get the fallback body of an intrinsic, we need to convert it to an item. ty::InstanceKind::Intrinsic(def_id) => ty::Instance::new(def_id, instance.args), @@ -30,7 +30,7 @@ impl<'tcx> BodyBuilder<'tcx> { /// Build a stable monomorphic body for a given instance based on the MIR body. /// /// All constants are also evaluated. - pub fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body { + pub(crate) fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body { let body = tables.tcx.instance_mir(self.instance.def).clone(); let mono_body = if !self.instance.args.is_empty() // Without the `generic_const_exprs` feature gate, anon consts in signatures do not diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs index f9663f2dd30d9..a4ede374a19dc 100644 --- a/compiler/rustc_smir/src/rustc_smir/context.rs +++ b/compiler/rustc_smir/src/rustc_smir/context.rs @@ -784,7 +784,7 @@ impl<'tcx> Context for TablesWrapper<'tcx> { } } -pub struct TablesWrapper<'tcx>(pub RefCell>); +pub(crate) struct TablesWrapper<'tcx>(pub RefCell>); /// Implement error handling for extracting function ABI information. impl<'tcx> FnAbiOfHelpers<'tcx> for Tables<'tcx> { diff --git a/compiler/rustc_smir/src/rustc_smir/convert/mod.rs b/compiler/rustc_smir/src/rustc_smir/convert/mod.rs index 50687935473a7..c9795fca3993a 100644 --- a/compiler/rustc_smir/src/rustc_smir/convert/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/convert/mod.rs @@ -9,7 +9,7 @@ mod error; mod mir; mod ty; -pub use ty::mir_const_from_ty_const; +pub(crate) use ty::mir_const_from_ty_const; impl<'tcx> Stable<'tcx> for rustc_hir::Safety { type T = stable_mir::mir::Safety; diff --git a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs index 9afd732486c28..efbb0f244fc8f 100644 --- a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs +++ b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs @@ -411,7 +411,7 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> { } } -pub fn mir_const_from_ty_const<'tcx>( +pub(crate) fn mir_const_from_ty_const<'tcx>( tables: &mut Tables<'tcx>, ty_const: ty::Const<'tcx>, ty: Ty<'tcx>, diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs index ba7e0cec5bd80..28ce883daee9a 100644 --- a/compiler/rustc_span/src/analyze_source_file.rs +++ b/compiler/rustc_span/src/analyze_source_file.rs @@ -8,7 +8,7 @@ mod tests; /// /// This function will use an SSE2 enhanced implementation if hardware support /// is detected at runtime. -pub fn analyze_source_file(src: &str) -> (Vec, Vec) { +pub(crate) fn analyze_source_file(src: &str) -> (Vec, Vec) { let mut lines = vec![RelativeBytePos::from_u32(0)]; let mut multi_byte_chars = vec![]; diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index a6ec15d5d3641..c7bd7321f0c5c 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -30,6 +30,7 @@ #![feature(round_char_boundary)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end // The code produced by the `Encodable`/`Decodable` derive macros refer to diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index 8988becb17126..3047abfbb5cb0 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -424,7 +424,7 @@ impl Span { } #[derive(Default)] -pub struct SpanInterner { +pub(crate) struct SpanInterner { spans: FxIndexSet, } diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs index dea4eb08c7615..0c97cda81c8af 100644 --- a/compiler/rustc_symbol_mangling/src/lib.rs +++ b/compiler/rustc_symbol_mangling/src/lib.rs @@ -93,6 +93,7 @@ #![doc(rust_logo)] #![feature(let_chains)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end use rustc_hir::def::DefKind; diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs index 04020d13f22f9..55b65fb1caaaf 100644 --- a/compiler/rustc_target/src/abi/call/aarch64.rs +++ b/compiler/rustc_target/src/abi/call/aarch64.rs @@ -6,7 +6,7 @@ use crate::abi::{HasDataLayout, TyAbiInterface}; /// /// Corresponds to Clang's `AArch64ABIInfo::ABIKind`. #[derive(Copy, Clone, PartialEq)] -pub enum AbiKind { +pub(crate) enum AbiKind { AAPCS, DarwinPCS, Win64, @@ -109,7 +109,7 @@ where arg.make_indirect(); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/amdgpu.rs b/compiler/rustc_target/src/abi/call/amdgpu.rs index e30dead63cbf8..3007a729a8b8a 100644 --- a/compiler/rustc_target/src/abi/call/amdgpu.rs +++ b/compiler/rustc_target/src/abi/call/amdgpu.rs @@ -17,7 +17,7 @@ where arg.extend_integer_width_to(32); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/arm.rs b/compiler/rustc_target/src/abi/call/arm.rs index 9371e1b395865..bd6f781fb8120 100644 --- a/compiler/rustc_target/src/abi/call/arm.rs +++ b/compiler/rustc_target/src/abi/call/arm.rs @@ -81,7 +81,7 @@ where arg.cast_to(Uniform::consecutive(if align <= 4 { Reg::i32() } else { Reg::i64() }, total)); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/avr.rs b/compiler/rustc_target/src/abi/call/avr.rs index b01dac8c70d7e..dfc991e09543a 100644 --- a/compiler/rustc_target/src/abi/call/avr.rs +++ b/compiler/rustc_target/src/abi/call/avr.rs @@ -44,7 +44,7 @@ fn classify_arg_ty(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fty: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fty: &mut FnAbi<'_, Ty>) { if !fty.ret.is_ignore() { classify_ret_ty(&mut fty.ret); } diff --git a/compiler/rustc_target/src/abi/call/bpf.rs b/compiler/rustc_target/src/abi/call/bpf.rs index 780e7df438373..f19772ac70918 100644 --- a/compiler/rustc_target/src/abi/call/bpf.rs +++ b/compiler/rustc_target/src/abi/call/bpf.rs @@ -17,7 +17,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/csky.rs b/compiler/rustc_target/src/abi/call/csky.rs index 7951f28beeaff..b1c1ae814a7ed 100644 --- a/compiler/rustc_target/src/abi/call/csky.rs +++ b/compiler/rustc_target/src/abi/call/csky.rs @@ -47,7 +47,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/hexagon.rs b/compiler/rustc_target/src/abi/call/hexagon.rs index 80a442048d53c..0a0688880c019 100644 --- a/compiler/rustc_target/src/abi/call/hexagon.rs +++ b/compiler/rustc_target/src/abi/call/hexagon.rs @@ -16,7 +16,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/loongarch.rs b/compiler/rustc_target/src/abi/call/loongarch.rs index 893818af77c30..4a21935623b92 100644 --- a/compiler/rustc_target/src/abi/call/loongarch.rs +++ b/compiler/rustc_target/src/abi/call/loongarch.rs @@ -325,7 +325,7 @@ fn extend_integer_width(arg: &mut ArgAbi<'_, Ty>, xlen: u64) { arg.extend_integer_width_to(xlen); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/m68k.rs b/compiler/rustc_target/src/abi/call/m68k.rs index 06697bdd83ee7..b6bd68b66fcc4 100644 --- a/compiler/rustc_target/src/abi/call/m68k.rs +++ b/compiler/rustc_target/src/abi/call/m68k.rs @@ -20,7 +20,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/mips.rs b/compiler/rustc_target/src/abi/call/mips.rs index 0e5a7f37a094c..37980a91c7601 100644 --- a/compiler/rustc_target/src/abi/call/mips.rs +++ b/compiler/rustc_target/src/abi/call/mips.rs @@ -35,7 +35,7 @@ where *offset = offset.align_to(align) + size.align_to(align); } -pub fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>) +pub(crate) fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>) where C: HasDataLayout, { diff --git a/compiler/rustc_target/src/abi/call/mips64.rs b/compiler/rustc_target/src/abi/call/mips64.rs index 5b52ebbdedd1a..2c3258c8d42d4 100644 --- a/compiler/rustc_target/src/abi/call/mips64.rs +++ b/compiler/rustc_target/src/abi/call/mips64.rs @@ -149,7 +149,7 @@ where }); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/msp430.rs b/compiler/rustc_target/src/abi/call/msp430.rs index 33ef47be00993..4f613aa6c1549 100644 --- a/compiler/rustc_target/src/abi/call/msp430.rs +++ b/compiler/rustc_target/src/abi/call/msp430.rs @@ -25,7 +25,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/nvptx64.rs b/compiler/rustc_target/src/abi/call/nvptx64.rs index 27d197af7925b..2e8b16d3a938e 100644 --- a/compiler/rustc_target/src/abi/call/nvptx64.rs +++ b/compiler/rustc_target/src/abi/call/nvptx64.rs @@ -71,7 +71,7 @@ where } } -pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } @@ -84,7 +84,7 @@ pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { } } -pub fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/powerpc.rs b/compiler/rustc_target/src/abi/call/powerpc.rs index 8f67f57cd2b3e..f3b05c4817301 100644 --- a/compiler/rustc_target/src/abi/call/powerpc.rs +++ b/compiler/rustc_target/src/abi/call/powerpc.rs @@ -27,7 +27,7 @@ fn classify_arg(cx: &impl HasTargetSpec, arg: &mut ArgAbi<'_, Ty>) { } } -pub fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs index 749eea0ef6350..b9767bf906bd0 100644 --- a/compiler/rustc_target/src/abi/call/powerpc64.rs +++ b/compiler/rustc_target/src/abi/call/powerpc64.rs @@ -86,7 +86,7 @@ where }; } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/riscv.rs b/compiler/rustc_target/src/abi/call/riscv.rs index 84f13f8cc5da9..be6bc701b497e 100644 --- a/compiler/rustc_target/src/abi/call/riscv.rs +++ b/compiler/rustc_target/src/abi/call/riscv.rs @@ -331,7 +331,7 @@ fn extend_integer_width(arg: &mut ArgAbi<'_, Ty>, xlen: u64) { arg.extend_integer_width_to(xlen); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/s390x.rs b/compiler/rustc_target/src/abi/call/s390x.rs index 901ce139c7be1..502e733126777 100644 --- a/compiler/rustc_target/src/abi/call/s390x.rs +++ b/compiler/rustc_target/src/abi/call/s390x.rs @@ -54,7 +54,7 @@ where } } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/sparc.rs b/compiler/rustc_target/src/abi/call/sparc.rs index 0e5a7f37a094c..37980a91c7601 100644 --- a/compiler/rustc_target/src/abi/call/sparc.rs +++ b/compiler/rustc_target/src/abi/call/sparc.rs @@ -35,7 +35,7 @@ where *offset = offset.align_to(align) + size.align_to(align); } -pub fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>) +pub(crate) fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>) where C: HasDataLayout, { diff --git a/compiler/rustc_target/src/abi/call/sparc64.rs b/compiler/rustc_target/src/abi/call/sparc64.rs index 311691d8efb9b..2954d9642df95 100644 --- a/compiler/rustc_target/src/abi/call/sparc64.rs +++ b/compiler/rustc_target/src/abi/call/sparc64.rs @@ -7,7 +7,7 @@ use crate::abi::{self, HasDataLayout, Scalar, Size, TyAbiInterface, TyAndLayout} use crate::spec::HasTargetSpec; #[derive(Clone, Debug)] -pub struct Sdata { +struct Sdata { pub prefix: [Option; 8], pub prefix_index: usize, pub last_offset: Size, @@ -209,7 +209,7 @@ where arg.cast_to(Uniform::new(Reg::i64(), total)); } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/wasm.rs b/compiler/rustc_target/src/abi/call/wasm.rs index a773fb1e814e0..4ae8b9490ddab 100644 --- a/compiler/rustc_target/src/abi/call/wasm.rs +++ b/compiler/rustc_target/src/abi/call/wasm.rs @@ -45,7 +45,7 @@ where } /// The purpose of this ABI is to match the C ABI (aka clang) exactly. -pub fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, @@ -69,7 +69,7 @@ where /// This ABI is *bad*! It uses `PassMode::Direct` for `abi::Aggregate` types, which leaks LLVM /// implementation details into the ABI. It's just hard to fix because ABIs are hard to change. /// Also see . -pub fn compute_wasm_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_wasm_abi_info(fn_abi: &mut FnAbi<'_, Ty>) { if !fn_abi.ret.is_ignore() { classify_ret_wasm_abi(&mut fn_abi.ret); } diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs index e9aedc3d28a1e..bdb14350ded4b 100644 --- a/compiler/rustc_target/src/abi/call/x86.rs +++ b/compiler/rustc_target/src/abi/call/x86.rs @@ -3,12 +3,12 @@ use crate::abi::{Abi, Align, HasDataLayout, TyAbiInterface, TyAndLayout}; use crate::spec::HasTargetSpec; #[derive(PartialEq)] -pub enum Flavor { +pub(crate) enum Flavor { General, FastcallOrVectorcall, } -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/abi/call/x86_64.rs b/compiler/rustc_target/src/abi/call/x86_64.rs index fcd712489fa40..1209204debfa3 100644 --- a/compiler/rustc_target/src/abi/call/x86_64.rs +++ b/compiler/rustc_target/src/abi/call/x86_64.rs @@ -170,7 +170,7 @@ fn cast_target(cls: &[Option], size: Size) -> CastTarget { const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9 const MAX_SSE_REGS: usize = 8; // XMM0-7 -pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout, diff --git a/compiler/rustc_target/src/abi/call/x86_win64.rs b/compiler/rustc_target/src/abi/call/x86_win64.rs index 720707ef53f95..e5a20b248e43b 100644 --- a/compiler/rustc_target/src/abi/call/x86_win64.rs +++ b/compiler/rustc_target/src/abi/call/x86_win64.rs @@ -4,7 +4,7 @@ use crate::spec::HasTargetSpec; // Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing -pub fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { +pub(crate) fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { let fixup = |a: &mut ArgAbi<'_, Ty>| { match a.layout.abi { Abi::Uninhabited | Abi::Aggregate { sized: false } => {} diff --git a/compiler/rustc_target/src/abi/call/xtensa.rs b/compiler/rustc_target/src/abi/call/xtensa.rs index 0994ff4798805..cb61bf2c56bea 100644 --- a/compiler/rustc_target/src/abi/call/xtensa.rs +++ b/compiler/rustc_target/src/abi/call/xtensa.rs @@ -96,7 +96,7 @@ where } } -pub fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>) +pub(crate) fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, diff --git a/compiler/rustc_target/src/asm/aarch64.rs b/compiler/rustc_target/src/asm/aarch64.rs index daf5162e8ac10..74970a26b23bf 100644 --- a/compiler/rustc_target/src/asm/aarch64.rs +++ b/compiler/rustc_target/src/asm/aarch64.rs @@ -70,7 +70,7 @@ impl AArch64InlineAsmRegClass { } } -pub fn target_reserves_x18(target: &Target) -> bool { +pub(crate) fn target_reserves_x18(target: &Target) -> bool { target.os == "android" || target.os == "fuchsia" || target.is_like_osx || target.is_like_windows } diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index b2116c5121695..d7c66d6f5e3d6 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -17,6 +17,7 @@ #![feature(let_chains)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end use std::path::{Path, PathBuf}; diff --git a/compiler/rustc_target/src/spec/base/aix.rs b/compiler/rustc_target/src/spec/base/aix.rs index c71c4ba2cc902..e7e9ec663c4c8 100644 --- a/compiler/rustc_target/src/spec/base/aix.rs +++ b/compiler/rustc_target/src/spec/base/aix.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { abi: "vec-extabi".into(), code_model: Some(CodeModel::Small), diff --git a/compiler/rustc_target/src/spec/base/android.rs b/compiler/rustc_target/src/spec/base/android.rs index 5320f1b4bbbea..dfa0e3fe9899a 100644 --- a/compiler/rustc_target/src/spec/base/android.rs +++ b/compiler/rustc_target/src/spec/base/android.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, TargetOptions, TlsModel}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut base = base::linux::opts(); base.os = "android".into(); base.is_like_android = true; diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index 39d7cf7d0971c..b752a34439537 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -12,7 +12,7 @@ mod tests; use Arch::*; #[allow(non_camel_case_types)] #[derive(Copy, Clone, PartialEq)] -pub enum Arch { +pub(crate) enum Arch { Armv7k, Armv7s, Arm64, @@ -25,7 +25,7 @@ pub enum Arch { } impl Arch { - pub fn target_name(self) -> &'static str { + fn target_name(self) -> &'static str { match self { Armv7k => "armv7k", Armv7s => "armv7s", @@ -39,7 +39,7 @@ impl Arch { } } - pub fn target_arch(self) -> Cow<'static, str> { + pub(crate) fn target_arch(self) -> Cow<'static, str> { Cow::Borrowed(match self { Armv7k | Armv7s => "arm", Arm64 | Arm64e | Arm64_32 => "aarch64", @@ -80,7 +80,7 @@ impl Arch { } #[derive(Copy, Clone, PartialEq)] -pub enum TargetAbi { +pub(crate) enum TargetAbi { Normal, Simulator, MacCatalyst, @@ -142,7 +142,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: TargetAbi) -> LinkArgs { args } -pub fn opts(os: &'static str, arch: Arch, abi: TargetAbi) -> TargetOptions { +pub(crate) fn opts(os: &'static str, arch: Arch, abi: TargetAbi) -> TargetOptions { TargetOptions { abi: abi.target_abi().into(), os: os.into(), @@ -279,7 +279,7 @@ fn macos_deployment_target(arch: Arch) -> (u32, u32) { .unwrap_or_else(|| macos_default_deployment_target(arch)) } -pub fn macos_llvm_target(arch: Arch) -> String { +pub(crate) fn macos_llvm_target(arch: Arch) -> String { let (major, minor) = macos_deployment_target(arch); format!("{}-apple-macosx{}.{}.0", arch.target_name(), major, minor) } @@ -333,7 +333,7 @@ fn ios_deployment_target(arch: Arch, abi: &str) -> (u32, u32) { from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((major, minor)) } -pub fn ios_llvm_target(arch: Arch) -> String { +pub(crate) fn ios_llvm_target(arch: Arch) -> String { // Modern iOS tooling extracts information about deployment target // from LC_BUILD_VERSION. This load command will only be emitted when // we build with a version specific `llvm_target`, with the version @@ -344,12 +344,12 @@ pub fn ios_llvm_target(arch: Arch) -> String { format!("{}-apple-ios{}.{}.0", arch.target_name(), major, minor) } -pub fn mac_catalyst_llvm_target(arch: Arch) -> String { +pub(crate) fn mac_catalyst_llvm_target(arch: Arch) -> String { let (major, minor) = ios_deployment_target(arch, "macabi"); format!("{}-apple-ios{}.{}.0-macabi", arch.target_name(), major, minor) } -pub fn ios_sim_llvm_target(arch: Arch) -> String { +pub(crate) fn ios_sim_llvm_target(arch: Arch) -> String { let (major, minor) = ios_deployment_target(arch, "sim"); format!("{}-apple-ios{}.{}.0-simulator", arch.target_name(), major, minor) } @@ -360,12 +360,12 @@ fn tvos_deployment_target() -> (u32, u32) { from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((10, 0)) } -pub fn tvos_llvm_target(arch: Arch) -> String { +pub(crate) fn tvos_llvm_target(arch: Arch) -> String { let (major, minor) = tvos_deployment_target(); format!("{}-apple-tvos{}.{}.0", arch.target_name(), major, minor) } -pub fn tvos_sim_llvm_target(arch: Arch) -> String { +pub(crate) fn tvos_sim_llvm_target(arch: Arch) -> String { let (major, minor) = tvos_deployment_target(); format!("{}-apple-tvos{}.{}.0-simulator", arch.target_name(), major, minor) } @@ -376,12 +376,12 @@ fn watchos_deployment_target() -> (u32, u32) { from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) } -pub fn watchos_llvm_target(arch: Arch) -> String { +pub(crate) fn watchos_llvm_target(arch: Arch) -> String { let (major, minor) = watchos_deployment_target(); format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor) } -pub fn watchos_sim_llvm_target(arch: Arch) -> String { +pub(crate) fn watchos_sim_llvm_target(arch: Arch) -> String { let (major, minor) = watchos_deployment_target(); format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor) } @@ -392,12 +392,12 @@ fn visionos_deployment_target() -> (u32, u32) { from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0)) } -pub fn visionos_llvm_target(arch: Arch) -> String { +pub(crate) fn visionos_llvm_target(arch: Arch) -> String { let (major, minor) = visionos_deployment_target(); format!("{}-apple-visionos{}.{}.0", arch.target_name(), major, minor) } -pub fn visionos_sim_llvm_target(arch: Arch) -> String { +pub(crate) fn visionos_sim_llvm_target(arch: Arch) -> String { let (major, minor) = visionos_deployment_target(); format!("{}-apple-visionos{}.{}.0-simulator", arch.target_name(), major, minor) } diff --git a/compiler/rustc_target/src/spec/base/avr_gnu.rs b/compiler/rustc_target/src/spec/base/avr_gnu.rs index c3d0344ea6c13..dd9fc32b69e6c 100644 --- a/compiler/rustc_target/src/spec/base/avr_gnu.rs +++ b/compiler/rustc_target/src/spec/base/avr_gnu.rs @@ -6,7 +6,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}; /// /// Requires GNU avr-gcc and avr-binutils on the host system. /// FIXME: Remove the second parameter when const string concatenation is possible. -pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target { +pub(crate) fn target(target_cpu: &'static str, mmcu: &'static str) -> Target { Target { arch: "avr".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/base/bpf.rs b/compiler/rustc_target/src/spec/base/bpf.rs index 4d03747d0165f..17d5e75ef6d01 100644 --- a/compiler/rustc_target/src/spec/base/bpf.rs +++ b/compiler/rustc_target/src/spec/base/bpf.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions}; -pub fn opts(endian: Endian) -> TargetOptions { +pub(crate) fn opts(endian: Endian) -> TargetOptions { TargetOptions { allow_asm: true, endian, diff --git a/compiler/rustc_target/src/spec/base/dragonfly.rs b/compiler/rustc_target/src/spec/base/dragonfly.rs index 3c1846696f7a4..5da23f2b8fda1 100644 --- a/compiler/rustc_target/src/spec/base/dragonfly.rs +++ b/compiler/rustc_target/src/spec/base/dragonfly.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "dragonfly".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/freebsd.rs b/compiler/rustc_target/src/spec/base/freebsd.rs index c772754aa8ddc..a016489e52dcd 100644 --- a/compiler/rustc_target/src/spec/base/freebsd.rs +++ b/compiler/rustc_target/src/spec/base/freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "freebsd".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/fuchsia.rs b/compiler/rustc_target/src/spec/base/fuchsia.rs index d1ac22f3a098c..fc3d9f6fb9ff6 100644 --- a/compiler/rustc_target/src/spec/base/fuchsia.rs +++ b/compiler/rustc_target/src/spec/base/fuchsia.rs @@ -2,7 +2,7 @@ use crate::spec::{ crt_objects, cvs, Cc, FramePointer, LinkOutputKind, LinkerFlavor, Lld, TargetOptions, }; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { // This mirrors the linker options provided by clang. We presume lld for // now. When using clang as the linker it will supply these options for us, // so we only list them for ld/lld. diff --git a/compiler/rustc_target/src/spec/base/haiku.rs b/compiler/rustc_target/src/spec/base/haiku.rs index 8ab874410aa1c..d90e4c99f93e3 100644 --- a/compiler/rustc_target/src/spec/base/haiku.rs +++ b/compiler/rustc_target/src/spec/base/haiku.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "haiku".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/hermit.rs b/compiler/rustc_target/src/spec/base/hermit.rs index c6e98fc1a115f..971abef80d9b1 100644 --- a/compiler/rustc_target/src/spec/base/hermit.rs +++ b/compiler/rustc_target/src/spec/base/hermit.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, TargetOptions, TlsModel}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "hermit".into(), linker: Some("rust-lld".into()), diff --git a/compiler/rustc_target/src/spec/base/hurd.rs b/compiler/rustc_target/src/spec/base/hurd.rs index 76f8223c0e4ed..d464d50ecc28c 100644 --- a/compiler/rustc_target/src/spec/base/hurd.rs +++ b/compiler/rustc_target/src/spec/base/hurd.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "hurd".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/hurd_gnu.rs b/compiler/rustc_target/src/spec/base/hurd_gnu.rs index 3501dbdea1b59..70d423217a60c 100644 --- a/compiler/rustc_target/src/spec/base/hurd_gnu.rs +++ b/compiler/rustc_target/src/spec/base/hurd_gnu.rs @@ -1,5 +1,5 @@ use crate::spec::{base, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { env: "gnu".into(), ..base::hurd::opts() } } diff --git a/compiler/rustc_target/src/spec/base/illumos.rs b/compiler/rustc_target/src/spec/base/illumos.rs index f0a648b93ad04..fa743a0c66d8d 100644 --- a/compiler/rustc_target/src/spec/base/illumos.rs +++ b/compiler/rustc_target/src/spec/base/illumos.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, FramePointer, LinkerFlavor, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let late_link_args = TargetOptions::link_args( LinkerFlavor::Unix(Cc::Yes), &[ diff --git a/compiler/rustc_target/src/spec/base/l4re.rs b/compiler/rustc_target/src/spec/base/l4re.rs index 3a4d83fad1751..dbe9e78a193b9 100644 --- a/compiler/rustc_target/src/spec/base/l4re.rs +++ b/compiler/rustc_target/src/spec/base/l4re.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "l4re".into(), env: "uclibc".into(), diff --git a/compiler/rustc_target/src/spec/base/linux.rs b/compiler/rustc_target/src/spec/base/linux.rs index 34b2eb0f64174..2e30364525e6b 100644 --- a/compiler/rustc_target/src/spec/base/linux.rs +++ b/compiler/rustc_target/src/spec/base/linux.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{cvs, RelroLevel, SplitDebuginfo, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "linux".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/linux_gnu.rs b/compiler/rustc_target/src/spec/base/linux_gnu.rs index 3491277c44077..1200add4fe1e2 100644 --- a/compiler/rustc_target/src/spec/base/linux_gnu.rs +++ b/compiler/rustc_target/src/spec/base/linux_gnu.rs @@ -1,5 +1,5 @@ use crate::spec::{base, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { env: "gnu".into(), ..base::linux::opts() } } diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs index 42aa1e1a6daf4..a29635112fffa 100644 --- a/compiler/rustc_target/src/spec/base/linux_musl.rs +++ b/compiler/rustc_target/src/spec/base/linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, crt_objects, LinkSelfContainedDefault, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut base = base::linux::opts(); base.env = "musl".into(); diff --git a/compiler/rustc_target/src/spec/base/linux_ohos.rs b/compiler/rustc_target/src/spec/base/linux_ohos.rs index 8272cda05e791..2372bc2c71814 100644 --- a/compiler/rustc_target/src/spec/base/linux_ohos.rs +++ b/compiler/rustc_target/src/spec/base/linux_ohos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, TargetOptions, TlsModel}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut base = base::linux::opts(); base.env = "ohos".into(); diff --git a/compiler/rustc_target/src/spec/base/linux_uclibc.rs b/compiler/rustc_target/src/spec/base/linux_uclibc.rs index 540344e9e94d1..80a6479bb5f9a 100644 --- a/compiler/rustc_target/src/spec/base/linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/base/linux_uclibc.rs @@ -1,5 +1,5 @@ use crate::spec::{base, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { env: "uclibc".into(), ..base::linux::opts() } } diff --git a/compiler/rustc_target/src/spec/base/msvc.rs b/compiler/rustc_target/src/spec/base/msvc.rs index 720cf03005a5e..b0fb2ef4b27f2 100644 --- a/compiler/rustc_target/src/spec/base/msvc.rs +++ b/compiler/rustc_target/src/spec/base/msvc.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { // Suppress the verbose logo and authorship debugging output, which would needlessly // clog any log files. let pre_link_args = TargetOptions::link_args(LinkerFlavor::Msvc(Lld::No), &["/NOLOGO"]); diff --git a/compiler/rustc_target/src/spec/base/netbsd.rs b/compiler/rustc_target/src/spec/base/netbsd.rs index 495e3d10fbccd..1ae81eb0633ef 100644 --- a/compiler/rustc_target/src/spec/base/netbsd.rs +++ b/compiler/rustc_target/src/spec/base/netbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "netbsd".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/nto_qnx.rs b/compiler/rustc_target/src/spec/base/nto_qnx.rs index f1405e9b44667..47177415b3942 100644 --- a/compiler/rustc_target/src/spec/base/nto_qnx.rs +++ b/compiler/rustc_target/src/spec/base/nto_qnx.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { crt_static_respected: true, dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/openbsd.rs b/compiler/rustc_target/src/spec/base/openbsd.rs index bc3aecb5c1e83..942ac4a393c5c 100644 --- a/compiler/rustc_target/src/spec/base/openbsd.rs +++ b/compiler/rustc_target/src/spec/base/openbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions, TlsModel}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "openbsd".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/redox.rs b/compiler/rustc_target/src/spec/base/redox.rs index 9070791e9dfc4..3f13f1f884195 100644 --- a/compiler/rustc_target/src/spec/base/redox.rs +++ b/compiler/rustc_target/src/spec/base/redox.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "redox".into(), env: "relibc".into(), diff --git a/compiler/rustc_target/src/spec/base/solaris.rs b/compiler/rustc_target/src/spec/base/solaris.rs index f97cdb4fb2842..1529cd65b28c4 100644 --- a/compiler/rustc_target/src/spec/base/solaris.rs +++ b/compiler/rustc_target/src/spec/base/solaris.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "solaris".into(), dynamic_linking: true, diff --git a/compiler/rustc_target/src/spec/base/solid.rs b/compiler/rustc_target/src/spec/base/solid.rs index ce4a8869001bc..fd55e1d150141 100644 --- a/compiler/rustc_target/src/spec/base/solid.rs +++ b/compiler/rustc_target/src/spec/base/solid.rs @@ -1,6 +1,6 @@ use crate::spec::{FramePointer, TargetOptions}; -pub fn opts(kernel: &str) -> TargetOptions { +pub(crate) fn opts(kernel: &str) -> TargetOptions { TargetOptions { os: format!("solid_{kernel}").into(), vendor: "kmc".into(), diff --git a/compiler/rustc_target/src/spec/base/teeos.rs b/compiler/rustc_target/src/spec/base/teeos.rs index 38d0a6d73140a..94eb946dda46b 100644 --- a/compiler/rustc_target/src/spec/base/teeos.rs +++ b/compiler/rustc_target/src/spec/base/teeos.rs @@ -1,6 +1,6 @@ use crate::spec::{add_link_args, Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"]; let cc_args = &["-Wl,-zmax-page-size=4096", "-Wl,-znow", "-Wl,-ztext", "-mexecute-only"]; diff --git a/compiler/rustc_target/src/spec/base/thumb.rs b/compiler/rustc_target/src/spec/base/thumb.rs index 0decfecb4cd1d..03ec679038c08 100644 --- a/compiler/rustc_target/src/spec/base/thumb.rs +++ b/compiler/rustc_target/src/spec/base/thumb.rs @@ -29,7 +29,7 @@ use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { // See rust-lang/rfcs#1645 for a discussion about these defaults TargetOptions { linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), diff --git a/compiler/rustc_target/src/spec/base/uefi_msvc.rs b/compiler/rustc_target/src/spec/base/uefi_msvc.rs index e8acd6078e2ad..0020106f40e87 100644 --- a/compiler/rustc_target/src/spec/base/uefi_msvc.rs +++ b/compiler/rustc_target/src/spec/base/uefi_msvc.rs @@ -11,7 +11,7 @@ use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut base = base::msvc::opts(); base.add_pre_link_args( diff --git a/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs index 9ccd0a1e7caec..fd81381572438 100644 --- a/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, PanicStrategy, RelocModel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "linux".into(), env: "musl".into(), diff --git a/compiler/rustc_target/src/spec/base/vxworks.rs b/compiler/rustc_target/src/spec/base/vxworks.rs index aa4784b63e7aa..425dd3c8cc232 100644 --- a/compiler/rustc_target/src/spec/base/vxworks.rs +++ b/compiler/rustc_target/src/spec/base/vxworks.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "vxworks".into(), env: "gnu".into(), diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs index f237391016e77..e417137ced1b1 100644 --- a/compiler/rustc_target/src/spec/base/wasm.rs +++ b/compiler/rustc_target/src/spec/base/wasm.rs @@ -3,7 +3,7 @@ use crate::spec::{ TargetOptions, TlsModel, }; -pub fn options() -> TargetOptions { +pub(crate) fn options() -> TargetOptions { macro_rules! args { ($prefix:literal) => { &[ diff --git a/compiler/rustc_target/src/spec/base/windows_gnu.rs b/compiler/rustc_target/src/spec/base/windows_gnu.rs index 7346e42dd9100..1393b1591842f 100644 --- a/compiler/rustc_target/src/spec/base/windows_gnu.rs +++ b/compiler/rustc_target/src/spec/base/windows_gnu.rs @@ -5,7 +5,7 @@ use crate::spec::{ Lld, SplitDebuginfo, TargetOptions, }; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::No, Lld::No), &[ diff --git a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs index 88c3b8a81ad22..9e89a3c75fead 100644 --- a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { // We cannot use `-nodefaultlibs` because compiler-rt has to be passed // as a path since it's not added to linker search path by the default. // There were attempts to make it behave like libgcc (so one can just use -l) diff --git a/compiler/rustc_target/src/spec/base/windows_msvc.rs b/compiler/rustc_target/src/spec/base/windows_msvc.rs index 6f886ec8a250f..e68043ca2ee69 100644 --- a/compiler/rustc_target/src/spec/base/windows_msvc.rs +++ b/compiler/rustc_target/src/spec/base/windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, cvs, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let base = base::msvc::opts(); TargetOptions { diff --git a/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs b/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs index 17256e18e24e3..8134b5feade9f 100644 --- a/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs +++ b/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{add_link_args, base, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let base = base::windows_gnu::opts(); // FIXME: This should be updated for the exception machinery changes from #67502 diff --git a/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs b/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs index 59a7616712541..f4f712145047e 100644 --- a/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs +++ b/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, LinkerFlavor, Lld, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { let mut opts = base::windows_msvc::opts(); opts.abi = "uwp".into(); diff --git a/compiler/rustc_target/src/spec/base/xtensa.rs b/compiler/rustc_target/src/spec/base/xtensa.rs index 31ad09c52e4fd..280dd16e26453 100644 --- a/compiler/rustc_target/src/spec/base/xtensa.rs +++ b/compiler/rustc_target/src/spec/base/xtensa.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions}; -pub fn opts() -> TargetOptions { +pub(crate) fn opts() -> TargetOptions { TargetOptions { os: "none".into(), endian: Endian::Little, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index 65f2a1e306987..912392c9fef08 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("macos", arch, TargetAbi::Normal); base.cpu = "apple-m1".into(); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index 11a39c26e9d25..7f3a86f3256ff 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("ios", arch, TargetAbi::Normal); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index 32c2367d5bfdb..e60eeda429565 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("ios", arch, TargetAbi::MacCatalyst); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index 703b886cc19ec..d605e22701af0 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("ios", arch, TargetAbi::Simulator); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index e97ad11cdf6c5..fc774ab94c880 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, tvos_llvm_target, Arch, TargetAbi}; use crate::spec::{FramePointer, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; Target { llvm_target: tvos_llvm_target(arch).into(), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index 8bfa9c8e8b7e1..8e8bb1efc9dfe 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch, TargetAbi}; use crate::spec::{FramePointer, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; Target { llvm_target: tvos_sim_llvm_target(arch).into(), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs index b0798e5e4f580..16c7d72daed85 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, visionos_llvm_target, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("visionos", arch, TargetAbi::Normal); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs index 7b2d2b6a8e442..42973e0268e12 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, visionos_sim_llvm_target, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; let mut base = opts("visionos", arch, TargetAbi::Simulator); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs index 6d66299d6d9e0..03fc2518d1d6b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = opts("watchos", Arch::Arm64, TargetAbi::Normal); Target { llvm_target: "aarch64-apple-watchos".into(), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index 9675a950d5d08..13e2b96179481 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch, TargetAbi}; use crate::spec::{FramePointer, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64; Target { // Clang automatically chooses a more specific target based on diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs index df389fe34bd69..5b8efd6626287 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs index 10a8e3e4df818..c14fa20b6973d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs index ba646cd6065fc..fe4dadfe8382d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-netbsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs index 3668db912bb81..144ac85622eef 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs @@ -1 +1 @@ -pub use crate::spec::targets::aarch64_unknown_fuchsia::target; +pub(crate) use crate::spec::targets::aarch64_unknown_fuchsia::target; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs index 1c2273bb3a1f3..1d054dad568a8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs @@ -1,6 +1,6 @@ use crate::spec::{base, RelocModel, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "aarch64-unknown-none".into(), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs index 3f0072c00c149..ff0a0762e3c80 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs @@ -3,7 +3,7 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a // for target ABI requirements. -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-linux-android".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs index 1ba4fbb3d256b..d6d49a4a07044 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs @@ -5,7 +5,7 @@ use crate::spec::{ const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld"); /// A base target for Nintendo Switch devices using a pure LLVM toolchain. -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-none".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs index 070460538c7a3..9d10358a49f80 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); base.max_atomic_width = Some(128); base.features = "+v8a,+neon,+fp-armv8".into(); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs index f4e2ee448057a..c3bd2ea6c332b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.max_atomic_width = Some(128); base.features = "+v8a,+neon,+fp-armv8".into(); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs index b10f1c7592e51..b993275ff8314 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-freebsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs index f84853fbb19c4..b462739e5617b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-fuchsia".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs index 55cb0b8f2ee78..e9da6a8f3ceb8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-hermit".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs index 7f05358e01610..bed9c88fd670b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::illumos::opts(); base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-std=c99"]); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs index 1a45c2c5c05ef..56709f788d3eb 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs index 851366b7647bc..71b331972cc0d 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu_ilp32".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 6b4a422a474a0..1cf71b650409c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.max_atomic_width = Some(128); base.supports_xray = true; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs index 726a85c81f39f..0dbf4cb7a705c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_ohos::opts(); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs index 0069d5431f8e5..e25beec0a1376 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-netbsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs index 169468f2e2482..54a08853c2860 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs @@ -11,7 +11,7 @@ use crate::spec::{ TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let opts = TargetOptions { linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), linker: Some("rust-lld".into()), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs index 222d5651b5211..7933041b584ec 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs @@ -10,7 +10,7 @@ use crate::spec::{ Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let opts = TargetOptions { abi: "softfloat".into(), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs index ac1bec02ec8ae..47a9b91663f84 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { // In QNX, libc does not provide a compatible ABI between versions. // To distinguish between QNX versions, we needed a stable conditional compilation switch, // which is why we needed to implement different targets in the compiler. diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs index 65a1863eb391a..5b5a21fca9527 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs @@ -1,6 +1,6 @@ use crate::spec::Target; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = super::aarch64_unknown_nto_qnx700::target(); base.metadata.description = Some("ARM64 QNX Neutrino 7.1 RTOS".into()); base.options.env = "nto71".into(); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs index e16991af4e665..8f6215df71a41 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-openbsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs index e59b38a3e4116..26c1a67109558 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::redox::opts(); base.max_atomic_width = Some(128); base.stack_probes = StackProbeType::Inline; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs index 5ae2d68332c6e..4e3d5ce34bc50 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::teeos::opts(); base.features = "+strict-align,+neon,+fp-armv8".into(); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs index 9fd7c24649896..69ab992e12ca1 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs @@ -2,7 +2,7 @@ use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-unknown-musl".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs index 429303170b6b8..bb580af7c4756 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs index df1b75272b1fe..630658efd0675 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); base.max_atomic_width = Some(128); base.features = "+v8a".into(); diff --git a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs index 41f7532ecdb19..3c0f92fa31fef 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index 2c76f4736de8e..f292ee7f56312 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, watchos_llvm_target, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64_32; let base = opts("watchos", arch, TargetAbi::Normal); Target { diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs index 6f28f5d054360..e86b8358a9c98 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64e; let mut base = opts("macos", arch, TargetAbi::Normal); base.cpu = "apple-m1".into(); diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs index 1590ae9679d88..fcb850f44bc85 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Arm64e; let mut base = opts("ios", arch, TargetAbi::Normal); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs index 21cb38868fb92..50c399bf4a88b 100644 --- a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{add_link_args, base, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.max_atomic_width = Some(128); base.features = "+v8a,+neon,+fp-armv8".into(); diff --git a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs index a22bcef47575c..350a01b196714 100644 --- a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "arm-linux-androideabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs index 8ff272e786db0..296f9d0b423d7 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-gnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs index e3e2f4cd05c2a..5d58055f1af35 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index f958b89358b18..89a80ae8bedd6 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // to determine the calling convention and float ABI, and it doesn't diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 98093fdc00324..200bb91796484 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and it diff --git a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs index b56f311793adc..a6ea48817c04f 100644 --- a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armeb-unknown-linux-gnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs index df32b74f6d9ac..d09624e0e7391 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs @@ -3,7 +3,7 @@ use crate::abi::Endian; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armebv7r-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs index 063038c801222..10669dcf09d79 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs @@ -3,7 +3,7 @@ use crate::abi::Endian; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armebv7r-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs index f873fb0d34957..2236e02d006fa 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs @@ -11,7 +11,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv4t-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs index 18f327bc87f7f..d88022ac10a2a 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv4t-unknown-linux-gnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs index 1fbe4b89ea177..3d8e75d3ee952 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, cvs, FramePointer, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs index 123686448378e..a73d8298ddeed 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-gnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index ccbc1e36ddece..91b0e2039c7f4 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // FIXME: this comment below does not seem applicable? // It's important we use "gnueabihf" and not "musleabihf" here. LLVM diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs index d88b88333b56d..65658ab45fc49 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-uclibcgnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs index 24e9d1e039494..52617237f207a 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv6-unknown-freebsd-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs index 62e328b9cbda2..eda1c028aad3a 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv6-unknown-netbsdelf-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs index bcdad0a55b316..b29ee2dd793b1 100644 --- a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs +++ b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs @@ -4,7 +4,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions} /// /// Requires the devkitARM toolchain for 3DS targets on the host system. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-specs=3dsx.specs", "-mtune=mpcore", "-mfloat-abi=hard", "-mtp=soft"], diff --git a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs index 8f6a58a1b4982..3bba22f8a1fa7 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs @@ -8,7 +8,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptio // See https://developer.android.com/ndk/guides/abis.html#v7a // for target ABI requirements. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::android::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]); Target { diff --git a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs index a9b5172385ba7..5f71d325efb0a 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs @@ -5,7 +5,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions} /// /// Requires the VITASDK toolchain on the host system. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q", "-Wl,--pic-veneer"], diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs index 3a16bbe95db34..b955acd0dca97 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-freebsd-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs index 8a4ba271456a9..703a9b132b2d9 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for glibc Linux on ARMv7 without thumb-mode, NEON or // hardfloat. -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs index a217a2daeb39e..db79810b5dd7d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for glibc Linux on ARMv7 without NEON or // thumb-mode. See the thumbv7neon variant for enabling both. -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 96459a5137fd1..e4e99eab853af 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for musl Linux on ARMv7 without thumb-mode, NEON or // hardfloat. -pub fn target() -> Target { +pub(crate) fn target() -> Target { // Most of these settings are copied from the armv7_unknown_linux_gnueabi // target. Target { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 6c878141fd495..5fc3f7031753d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for musl Linux on ARMv7 without thumb-mode or NEON. -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs index bffc51d9b7bca..040a953b12e94 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or // hardfloat. -pub fn target() -> Target { +pub(crate) fn target() -> Target { // Most of these settings are copied from the armv7_unknown_linux_musleabi // target. Target { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs index 9dc1221287dd0..af10d2d90123d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for uclibc Linux on ARMv7 without NEON, // thumb-mode or hardfloat. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = base::linux_uclibc::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabi".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs index 01a1468d3a8c9..53673daa8129b 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; // This target is for uclibc Linux on ARMv7 without NEON or // thumb-mode. See the thumbv7neon variant for enabling both. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = base::linux_uclibc::opts(); Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs index a2391503ff8ab..164acd17f21ee 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-netbsdelf-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs index 889cc20156979..1ad91b8f080e7 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs @@ -1,6 +1,6 @@ use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // to determine the calling convention and float ABI, and it doesn't diff --git a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs index 7d60ec1b64dda..f8faec918e4d6 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs index 76d4653931b88..aea897f56b885 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs @@ -1,6 +1,6 @@ use crate::spec::{base, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "armv7a-none-eabi".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs index d2b4d46adac6b..be526d6325004 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs @@ -1,6 +1,6 @@ use crate::spec::{base, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let base = base::solid::opts("asp3"); Target { llvm_target: "armv7a-none-eabihf".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs index b544c404f3f21..1e4798abfffb0 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs @@ -16,7 +16,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let opts = TargetOptions { abi: "eabi".into(), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs index aebb7e667bcd8..ab8b870c62859 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs @@ -7,7 +7,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let opts = TargetOptions { abi: "eabihf".into(), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), diff --git a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs index e876c567b09a1..35de6b35eaf2e 100644 --- a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Armv7k; Target { llvm_target: "armv7k-apple-watchos".into(), diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs index b3246dc792811..aba55f533a71d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7r-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs index 9ac500d7ffe7e..5a8519dcc49d0 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs @@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7r-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs index 11608794932b3..41eaa79d3eb22 100644 --- a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::Armv7s; Target { llvm_target: ios_llvm_target(arch).into(), diff --git a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs index ee940c3a76a24..042a9a140710c 100644 --- a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs @@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv8r-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs b/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs index bf01413a80adf..020322b27391d 100644 --- a/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs +++ b/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs @@ -1,5 +1,5 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { base::avr_gnu::target("atmega328", "-mmcu=atmega328") } diff --git a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs index eb223af8cf44f..f4c3a35ced585 100644 --- a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "bpfeb".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs index 12164adc00f25..6ef72c4021050 100644 --- a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "bpfel".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs index e8a0b465e1562..61c246fc4cbf8 100644 --- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs +++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; // This target is for glibc Linux on Csky -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { //https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h llvm_target: "csky-unknown-linux-gnuabiv2".into(), diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs index 99330ddc31894..91c33caae3e2a 100644 --- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs +++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; // This target is for glibc Linux on Csky -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { //https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h llvm_target: "csky-unknown-linux-gnuabiv2".into(), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index bd53979902969..cddc3a33f9fb3 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "hexagonv60".into(); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs index cefd0bf6d67b7..730b19abd2bd4 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{PanicStrategy, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-none-elf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs index b1b2b6cdffa8d..263393fd536ce 100644 --- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::I386; // i386-apple-ios is a simulator target, even though it isn't declared // that way in the target name like the other ones... diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs index 6c80ab6994ddc..cf0577d8cb01a 100644 --- a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs +++ b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "i586-pc-unknown".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs index befb0f89f3b03..dd38f86bced2e 100644 --- a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::Target; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = super::i686_pc_windows_msvc::target(); base.cpu = "pentium".into(); base.llvm_target = "i586-pc-windows-msvc".into(); diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs index b699a7af17749..e481e967ebfa2 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::Target; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = super::i686_unknown_linux_gnu::target(); base.cpu = "pentium".into(); base.llvm_target = "i586-unknown-linux-gnu".into(); diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs index 55a26eb004a7a..623422a89ea62 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::Target; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = super::i686_unknown_linux_musl::target(); base.cpu = "pentium".into(); base.llvm_target = "i586-unknown-linux-musl".into(); diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs index de42549b7f8df..3c5ba157c1ecc 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.cpu = "pentium".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs index 02f6bec4692fc..f173e8b7e4ae8 100644 --- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { // ld64 only understands i386 and not i686 let arch = Arch::I386; let mut base = opts("macos", arch, TargetAbi::Normal); diff --git a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs index fc313e575be6e..bce41976a9697 100644 --- a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs @@ -3,7 +3,7 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; // See https://developer.android.com/ndk/guides/abis.html#x86 // for target ABI requirements. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::android::opts(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs index 4b0f4bf3ecd25..7288359f564af 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs index 5bb082014298a..a38e67b96f0db 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs index 970b43ad109ba..a8e1ad45014ac 100644 --- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, LinkerFlavor, Lld, SanitizerSet, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs index cce21fcacb1c5..8ba58dfd705ba 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs index 84ef00f06c810..b2316fd3bf422 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::haiku::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs index ad8c0f7f582e7..2e303ff402fa6 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::hurd_gnu::opts(); base.cpu = "pentiumpro".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs index 5584435a0ad9d..15bc4da1775a0 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index d1ab1f73b511b..8dd08a9567b46 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs index 255148fca9a31..02a95ee6626f2 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs index d6df801234c66..b8c9efc7c471a 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs index 83252fadb78ea..0e00249d66cf7 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::redox::opts(); base.cpu = "pentiumpro".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs index b92fc2e759a30..3cda78003edbe 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs @@ -7,7 +7,7 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs index 851bea80fb830..901c9fc378d21 100644 --- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_uwp_gnu::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs index 28bd2aae8e711..c7703666ae032 100644 --- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs index cd488d0532c2f..79302cdc0a1a3 100644 --- a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs index 973c75eeca6e1..ba669334e7f4d 100644 --- a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); base.cpu = "pentium4".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs index 6f0bb449c16c0..d33c7af92c656 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index f7a6e0bd857f5..5540e71ad4f31 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs index c7f47da6972e7..5628519026831 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs @@ -2,7 +2,7 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-none".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs index 21e4f4a2b057b..7e57715ce7a73 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs @@ -2,7 +2,7 @@ use crate::spec::{ Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-none".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs index 7cff0efd112c8..9d9f6145e2f5d 100644 --- a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "M68020".into(); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index c3235bf994fa0..72577749ac64f 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -3,7 +3,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "mips64r2".into(); base.features = "+mips64r2,+soft-float".into(); diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs index cdf4ffb7f9eb5..1fad6be2f8df3 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mips64-unknown-linux-gnuabi64".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index 463f7dc47f72f..7627131bc2fe6 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "mips64r2".into(); base.features = "+mips64r2".into(); diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs index ad77a02c0630e..f93e5676b051d 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mips64el-unknown-linux-gnuabi64".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 83f5c7ea37d63..6fbb4f40024d9 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "mips64r2".into(); base.features = "+mips64r2".into(); diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs index 0bdfd6ee6b09d..778b0041214db 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index 8e27c9936c561..2cce3271c57f8 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "mips32r2".into(); base.features = "+mips32r2,+soft-float".into(); diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs index 852e1d9376d08..ef7d6bf82e321 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-uclibc".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs index 9d3f4d9f79501..850808b4c7ba1 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs @@ -3,7 +3,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions} // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); -pub fn target() -> Target { +pub(crate) fn target() -> Target { let pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::No, Lld::No), &["--emit-relocs", "--nmagic"], diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs index c0b99a68b0d07..761495b2a29fb 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-sony-psx".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs index 8fe4548a3ad95..2784b3714690c 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index 43914a2330800..1b2d8e9a105f2 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "mips32r2".into(); base.features = "+mips32r2,+soft-float".into(); diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs index 6150654c0817e..21f03a40ec2d5 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-uclibc".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs index 03501aa76a83f..ea2fb2e7f3aad 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.max_atomic_width = Some(32); base.cpu = "mips32".into(); diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs index 81aac3ce0b87f..bb8eb24908c23 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs @@ -4,7 +4,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-none".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs index 2ed520e9f48ff..5c07e9ea6dddb 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa32r6-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs index de30c5b35b75b..63b3cc47ffc26 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa32r6el-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs index 4178a991e14fe..7f5e2edb03613 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs index 8e50373bd124b..a2d807bcfe1b9 100644 --- a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs index de476741defd6..5bc5f79d1b6c6 100644 --- a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "msp430-none-elf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs index ec5edfb6e42c2..289251e906a0c 100644 --- a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs @@ -2,7 +2,7 @@ use crate::spec::{ LinkSelfContainedDefault, LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { arch: "nvptx64".into(), data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs index bda43e7a2b0f1..0f90efb4bb3db 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::aix::opts(); base.max_atomic_width = Some(64); base.add_pre_link_args( diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs index 6eb5bba0fcd99..89afe2343768e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); base.cpu = "ppc64".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs index 53b84479a4919..e39849c9b1883 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "ppc64".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 0d0484dd17480..24a56f917e5d5 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "ppc64".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs index 2922c921e17d1..1dab74e93762e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); base.cpu = "ppc64".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs index dd2ec27420762..1029a135e4aa7 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); base.cpu = "ppc64".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs index ea295cf169e0e..3c9d01e2d18d0 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); base.cpu = "ppc64le".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs index dc70bd238a749..df8f9f07c2f3e 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "ppc64le".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index dbfbd69b95b17..909a25304f46f 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "ppc64le".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs index 2f7acccfae83b..e8f09d70cc844 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); // Extra hint to linker that we are generating secure-PLT code. base.add_pre_link_args( diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs index 2ecafbb08bc33..9e5cea6eff586 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs index 04b2309fdc887..dbea70168a52a 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index 108e468eb66ba..86840f16d902c 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs index d19015729ec19..51cd3c186fa9a 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs index 3ee6cd46c8535..7129fe42876d3 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs index f00ee9604137f..6e98ecce45b74 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); base.endian = Endian::Big; base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs index 5d107d6e60ecd..b19513bf1d7c9 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "--secure-plt"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs index aea525a69123f..8484c160a99c2 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe", "--secure-plt"]); base.max_atomic_width = Some(32); diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs index e425d6a3f3fcb..8913df3b95465 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index 409b6b22f1cf9..5717e7a390754 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs index 631a31edeb5ec..1995de9dd2d7e 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs index 8aa5e0988902e..bd37cf80b4833 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs index 5fa3858e85744..32df30ddb5e3d 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs index 2022873d05cb5..61c887031bcf2 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs index 386e3a38f9757..0d453901efa73 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs index 7ced37e153577..cc28198e3ff0a 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs index aa51b8957fcd5..5ee6b3cbfa6ee 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs index cd50a9e60c32d..0eaabc60cbcd0 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs index 3661e38e7b1b3..c2882151d3d18 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs index 954660908912f..7395e1a6aad23 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs index fe49951ebfd6e..dcd4fcd9b4836 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs index d52dc8f96ca27..50d36e724a2c3 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs index ff9931978466e..0ae49debc3a38 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs index baee03e68333c..eab18064334a5 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs @@ -1,6 +1,6 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), llvm_target: "riscv32".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs index 2dfaf8a2033c6..00059a2691dc2 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{base, CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-linux-android".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs index 1fd6a4b38dcf1..8d2b16c45016e 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, CodeModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-freebsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs index 5c3f525966ed8..f5e6b1cbd78f4 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs @@ -1,6 +1,6 @@ use crate::spec::{base, CodeModel, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-fuchsia".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs index f11128cfcb676..3033479358ecd 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs @@ -1,6 +1,6 @@ use crate::spec::{base, CodeModel, RelocModel, Target, TargetOptions, TlsModel}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-hermit".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs index 308c995297bba..07253803f5c2e 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 8b40132986867..9b0b14cb1088d 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs index 65781f5af5c74..3eb9366c850b6 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, CodeModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-netbsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs index 61226809e52a2..c32c57d92f75b 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs @@ -3,7 +3,7 @@ use crate::spec::{ TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs index 5bea708e0dd23..27b8ae99753bc 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs @@ -3,7 +3,7 @@ use crate::spec::{ TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs index 5bdbda773b1bf..dca8a524b103f 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, CodeModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-openbsd".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs index b7444df04cd1f..d514f8efcd08c 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs @@ -3,7 +3,7 @@ use crate::spec::{ TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), llvm_target: "riscv64".into(), diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs index 80d58e5baceac..5fbc2a86fa942 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs @@ -3,7 +3,7 @@ use crate::spec::{ TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs index b0dd0eb612e16..e0a6c230fd6ae 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.endian = Endian::Big; // z10 is the oldest CPU supported by LLVM diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 3976233819cec..6aabe9ca51923 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.endian = Endian::Big; // z10 is the oldest CPU supported by LLVM diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs index eeb7eebfe5035..7c37fa0d63259 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.endian = Endian::Big; base.cpu = "v9".into(); diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs index 69bb6e1fb60e4..842e35392dcea 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.cpu = "v9".into(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs index 08f6eaf836176..a8767fa9d3c06 100644 --- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); base.endian = Endian::Big; base.cpu = "v9".into(); diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs index 8b7ff5d8011cf..7089fc511242a 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "sparc-unknown-linux-gnu".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs index c977fe608a78e..0cd4faefd6bb1 100644 --- a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let options = TargetOptions { linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), linker: Some("sparc-elf-gcc".into()), diff --git a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs index 1c0adadece0be..a932632b85740 100644 --- a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs +++ b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs @@ -1,7 +1,7 @@ use crate::abi::Endian; use crate::spec::{base, Cc, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::solaris::opts(); base.endian = Endian::Big; base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64"]); diff --git a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs index 8806f3e87fa2a..0f5e16408932f 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs @@ -11,7 +11,7 @@ use crate::spec::{base, cvs, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv4t-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs index d92e68cebaa65..6ae41ce439939 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, cvs, FramePointer, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv5te-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs index a0fa58d8175cf..9d4cc66c7f075 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv6m-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs index ac37f40386012..bc9d9856e036e 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv6m-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs index e36aa5ab395da..a927cf6902e92 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); // Prevent error LNK2013: BRANCH24(T) fixup overflow // The LBR optimization tries to eliminate branch islands, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs index 2e68dd0ec4e8a..473113854a81b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, PanicStrategy, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7a-pc-windows-msvc".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs index bd2df9236f67b..dca3e73dda570 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs @@ -11,7 +11,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs index e2499ef54112b..acc5acfbfb684 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs @@ -10,7 +10,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs index e21facb78f961..b4cd9686f5cc9 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs @@ -11,7 +11,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs index 45092711d2e18..bdb3a38be9391 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs @@ -10,7 +10,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7em-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs index 17e37f800f0b5..f5615de231544 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7m-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs index 4424b9eaadea6..0e3663e1603b9 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv7m-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs index c562f57252e59..9b4d13a96c8ff 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs @@ -8,7 +8,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; // See https://developer.android.com/ndk/guides/abis.html#v7a // for target ABI requirements. -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::android::opts(); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]); Target { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs index b5e91d61308be..b85b9b60b4209 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs @@ -6,7 +6,7 @@ use crate::spec::{base, Target, TargetOptions}; // registers enabled as well. See section A2.6.2 on page A2-56 in // https://web.archive.org/web/20210307234416/https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-gnueabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index 71d5eb43c1040..f53f21d721772 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -6,7 +6,7 @@ use crate::spec::{base, Target, TargetOptions}; // registers enabled as well. See section A2.6.2 on page A2-56 in // https://web.archive.org/web/20210307234416/https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs index e18bf113fe7c9..e392240a3335b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.base-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs index 44c6fb0dd1bfa..903b8f029114b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs @@ -2,7 +2,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.base-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs index 5c2f1e093819c..d287321c9f293 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs index 799ac45b479c4..74b143f69956e 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs @@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs index 2f0df7ae857bd..c5de209246c7a 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs @@ -3,7 +3,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabi".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs index ee31f17bc4511..44ad78b4684a7 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs @@ -3,7 +3,7 @@ use crate::spec::{base, cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "thumbv8m.main-none-eabihf".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs index 46257a272d1e1..c22f1589ca137 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs @@ -2,7 +2,7 @@ use crate::spec::{ base, cvs, LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { // Reset flags for non-Em flavors back to empty to satisfy sanity checking tests. let pre_link_args = LinkArgs::new(); let post_link_args = TargetOptions::link_args(LinkerFlavor::EmCc, &["-sABORTING_MALLOC=0"]); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs index bf92f30e8b372..300108530a5b2 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs @@ -12,7 +12,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut options = base::wasm::options(); options.os = "unknown".into(); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs index 2752125c00991..c317ebd95923d 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs @@ -6,6 +6,6 @@ use crate::spec::Target; -pub fn target() -> Target { +pub(crate) fn target() -> Target { super::wasm32_wasip1::target() } diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs index 29e6dff2068fc..7728d83c2b680 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs @@ -12,7 +12,7 @@ use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut options = base::wasm::options(); options.os = "wasi".into(); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs index 4e60806f3a736..0ae844c8da8ff 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs @@ -9,7 +9,7 @@ use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut options = base::wasm::options(); options.os = "wasi".into(); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs index 1a2533ecd7475..40f026ca93814 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs @@ -18,7 +18,7 @@ use crate::spec::{base, crt_objects, LinkSelfContainedDefault, RelocModel, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut options = base::wasm::options(); options.os = "wasi".into(); diff --git a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs index bc49a3c9f70d0..35c553744763f 100644 --- a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs @@ -9,7 +9,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut options = base::wasm::options(); options.os = "unknown".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index c3a52a506bc9d..7bf18026735dd 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64; let mut base = opts("macos", arch, TargetAbi::Normal); base.max_atomic_width = Some(128); // penryn+ supports cmpxchg16b diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs index 3cabca0336098..76a0bb1d91eef 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64; // x86_64-apple-ios is a simulator target, even though it isn't declared // that way in the target name like the other ones... diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs index c23a20ff0848e..f66efbbf709d1 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64; let mut base = opts("ios", arch, TargetAbi::MacCatalyst); base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs index 2a3125157dd9d..f9d5f6e77d9fc 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64; // x86_64-apple-tvos is a simulator target, even though it isn't declared // that way in the target name like the other ones... diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs index 62e60b5e32d04..1fced10c895ea 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch, TargetAbi}; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64; Target { llvm_target: watchos_sim_llvm_target(arch).into(), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs index 5a72fad826323..a3d18e5ecdaf0 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use crate::spec::{cvs, Cc, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::No, Lld::No), &[ diff --git a/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs index 46df00e9c02b7..ce3e1e159b7d7 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs @@ -1 +1 @@ -pub use crate::spec::targets::x86_64_unknown_fuchsia::target; +pub(crate) use crate::spec::targets::x86_64_unknown_fuchsia::target; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs index 257093b75545d..84a747e1feb29 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs @@ -2,7 +2,7 @@ use crate::spec::{ base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::android::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs index f6d22ff320494..45963565b06d2 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-pc-unknown".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs index 697daf590ad01..37cc7708d6310 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::solaris::opts(); base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64"]); base.cpu = "x86-64".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs index 89a9bb1e1cc53..8efebfd42bba7 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_gnu::opts(); base.cpu = "x86-64".into(); base.features = "+cx16,+sse3,+sahf".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs index acf0fd421bac9..056b0451bbebd 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_gnullvm::opts(); base.cpu = "x86-64".into(); base.features = "+cx16,+sse3,+sahf".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs index 3ef3e5114e682..d1881caa27321 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.cpu = "x86-64".into(); base.features = "+cx16,+sse3,+sahf".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index 883da26d786e1..43fac44e48b1f 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs index 171a6f2a51e7c..7ad0dc69e7bd1 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::dragonfly::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs index 4692b5a3c74ef..91cc6669f72c5 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::freebsd::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs index 5ebf1804302b7..836d41a096350 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs @@ -1,6 +1,6 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::fuchsia::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs index b593b79e7bbd4..7aab43b520aba 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::haiku::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs index 3e81ff9a4ec4e..6bc3ec5428648 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs @@ -1,6 +1,6 @@ use crate::spec::{base, StackProbeType, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-hermit".into(), metadata: crate::spec::TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs index d683a44202740..780fd6eb619e3 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::illumos::opts(); base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64", "-std=c99"]); base.cpu = "x86-64".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs index adf489ad7b1dd..f67e9f3b3f11c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, PanicStrategy, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::l4re::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs index 4a92d4ef9d5ca..80f49d3a64529 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs index 3c7db0095a148..dce23e2ebee0d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_gnu::opts(); base.cpu = "x86-64".into(); base.abi = "x32".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index 109fc3c0728d8..0262c8fd34fdd 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_musl::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs index b6e331bd85453..47ff0460d7bde 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux::opts(); base.cpu = "x86-64".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs index c1d888899fc21..28982bc13577d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::linux_ohos::opts(); base.cpu = "x86-64".into(); base.max_atomic_width = Some(64); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs index d413caf4aaf77..1ec07fe5a825e 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs @@ -2,7 +2,7 @@ use crate::spec::{ base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::netbsd::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs index 175a53f237da1..cfefb1de99387 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs @@ -9,7 +9,7 @@ use crate::spec::{ Target, TargetOptions, }; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let opts = TargetOptions { cpu: "x86-64".into(), plt_by_default: false, diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs index 8f1c3ef9bc7bb..580d0ef85309c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::openbsd::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs index ae38f63f034f7..5694395151899 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::redox::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs index 2933da92fcc31..f5ab3afffc32c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs @@ -8,7 +8,7 @@ use crate::abi::call::Conv; use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::uefi_msvc::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs index c71bc9ed92317..69c70c96d2b54 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_uwp_gnu::opts(); base.cpu = "x86-64".into(); base.features = "+cx16,+sse3,+sahf".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs index 178baeca68574..74493f0941f20 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_uwp_msvc::opts(); base.cpu = "x86-64".into(); base.features = "+cx16,+sse3,+sahf".into(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs index d44ae9fc4e0a1..815016e0adea5 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::windows_msvc::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs index 7b40f7366d0f3..604f71ffaa616 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs @@ -1,6 +1,6 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let mut base = base::vxworks::opts(); base.cpu = "x86-64".into(); base.plt_by_default = false; diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index a932d4a3cb466..9b9ffe4e5360e 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -1,7 +1,7 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { let arch = Arch::X86_64h; let mut base = opts("macos", arch, TargetAbi::Normal); base.max_atomic_width = Some(128); diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs index f041e791a9b0f..804659d3c5281 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs @@ -2,7 +2,7 @@ use crate::abi::Endian; use crate::spec::base::xtensa; use crate::spec::{cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs index 05666bd81aa13..51960dbec4af4 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs @@ -1,7 +1,7 @@ use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs index 83ef520551f55..6c15a82e95cd7 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs @@ -2,7 +2,7 @@ use crate::abi::Endian; use crate::spec::base::xtensa; use crate::spec::{cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs index aa125eb1ba689..21330615a874d 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs @@ -1,7 +1,7 @@ use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs index e18acfccf5ff2..536bd6dc1b2d9 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs @@ -2,7 +2,7 @@ use crate::abi::Endian; use crate::spec::base::xtensa; use crate::spec::{cvs, Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs index ecbb51dfb665d..fca47b4bdb121 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs @@ -1,7 +1,7 @@ use crate::spec::base::xtensa; use crate::spec::{Target, TargetOptions}; -pub fn target() -> Target { +pub(crate) fn target() -> Target { Target { llvm_target: "xtensa-none-elf".into(), pointer_width: 32, diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index aea47c9e987ae..a17c007debd8b 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -32,6 +32,7 @@ #![feature(unwrap_infallible)] #![feature(yeet_expr)] #![recursion_limit = "512"] // For rustdoc +#![warn(unreachable_pub)] // For rustdoc // tidy-alphabetical-end pub mod error_reporting; diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 4acbca994aaa3..8558520897b5c 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -54,7 +54,7 @@ pub fn add_placeholder_note(err: &mut Diag<'_, G>) { ); } -pub fn suggest_increasing_recursion_limit<'tcx, G: EmissionGuarantee>( +pub(crate) fn suggest_increasing_recursion_limit<'tcx, G: EmissionGuarantee>( tcx: TyCtxt<'tcx>, err: &mut Diag<'_, G>, overflowing_predicates: &[ty::Predicate<'tcx>], diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index fa696dcd2f59a..a3d5c5307974d 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -29,8 +29,8 @@ use tracing::{debug, instrument}; use super::elaborate; use crate::infer::TyCtxtInferExt; use crate::traits::query::evaluate_obligation::InferCtxtExt; -use crate::traits::{util, Obligation, ObligationCause}; -pub use crate::traits::{MethodViolationCode, ObjectSafetyViolation}; +pub use crate::traits::ObjectSafetyViolation; +use crate::traits::{util, MethodViolationCode, Obligation, ObligationCause}; /// Returns the object safety violations that affect HIR ty lowering. /// @@ -512,7 +512,7 @@ fn virtual_call_violations_for_method<'tcx>( /// /// This check is outlined from the object safety check to avoid cycles with /// layout computation, which relies on knowing whether methods are object safe. -pub fn check_receiver_correct<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, method: ty::AssocItem) { +fn check_receiver_correct<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, method: ty::AssocItem) { if !is_vtable_safe_method(tcx, trait_def_id, method) { return; } @@ -906,7 +906,7 @@ impl<'tcx> TypeFolder> for EraseEscapingBoundRegions<'tcx> { } } -pub fn contains_illegal_impl_trait_in_trait<'tcx>( +fn contains_illegal_impl_trait_in_trait<'tcx>( tcx: TyCtxt<'tcx>, fn_def_id: DefId, ty: ty::Binder<'tcx, Ty<'tcx>>, @@ -930,7 +930,7 @@ pub fn contains_illegal_impl_trait_in_trait<'tcx>( }) } -pub fn provide(providers: &mut Providers) { +pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { object_safety_violations, is_object_safe, diff --git a/compiler/rustc_trait_selection/src/traits/select/_match.rs b/compiler/rustc_trait_selection/src/traits/select/_match.rs index 7ead65721f9bb..f77f83ed4471c 100644 --- a/compiler/rustc_trait_selection/src/traits/select/_match.rs +++ b/compiler/rustc_trait_selection/src/traits/select/_match.rs @@ -21,12 +21,12 @@ use tracing::instrument; /// Like subtyping, matching is really a binary relation, so the only /// important thing about the result is Ok/Err. Also, matching never /// affects any type variables or unification state. -pub struct MatchAgainstFreshVars<'tcx> { +pub(crate) struct MatchAgainstFreshVars<'tcx> { tcx: TyCtxt<'tcx>, } impl<'tcx> MatchAgainstFreshVars<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstFreshVars<'tcx> { + pub(crate) fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstFreshVars<'tcx> { MatchAgainstFreshVars { tcx } } } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 12497e32b2db4..241c3a3d14122 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -3127,7 +3127,7 @@ impl<'o, 'tcx> fmt::Debug for TraitObligationStack<'o, 'tcx> { } } -pub enum ProjectionMatchesProjection { +pub(crate) enum ProjectionMatchesProjection { Yes, Ambiguous, No, diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 0689b880f3305..0fb13799e67d5 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -169,7 +169,7 @@ impl<'tcx> Iterator for TraitAliasExpander<'tcx> { /// Instantiate all bound parameters of the impl subject with the given args, /// returning the resulting subject and all obligations that arise. /// The obligations are closed under normalization. -pub fn impl_subject_and_oblig<'a, 'tcx>( +pub(crate) fn impl_subject_and_oblig<'a, 'tcx>( selcx: &SelectionContext<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, impl_def_id: DefId, @@ -209,7 +209,7 @@ pub fn upcast_choices<'tcx>( supertraits(tcx, source_trait_ref).filter(|r| r.def_id() == target_trait_def_id).collect() } -pub fn closure_trait_ref_and_return_type<'tcx>( +pub(crate) fn closure_trait_ref_and_return_type<'tcx>( tcx: TyCtxt<'tcx>, fn_trait_def_id: DefId, self_ty: Ty<'tcx>, @@ -238,7 +238,7 @@ pub fn closure_trait_ref_and_return_type<'tcx>( sig.map_bound(|sig| (trait_ref, sig.output())) } -pub fn coroutine_trait_ref_and_outputs<'tcx>( +pub(crate) fn coroutine_trait_ref_and_outputs<'tcx>( tcx: TyCtxt<'tcx>, fn_trait_def_id: DefId, self_ty: Ty<'tcx>, @@ -249,7 +249,7 @@ pub fn coroutine_trait_ref_and_outputs<'tcx>( (trait_ref, sig.yield_ty, sig.return_ty) } -pub fn future_trait_ref_and_outputs<'tcx>( +pub(crate) fn future_trait_ref_and_outputs<'tcx>( tcx: TyCtxt<'tcx>, fn_trait_def_id: DefId, self_ty: Ty<'tcx>, @@ -260,7 +260,7 @@ pub fn future_trait_ref_and_outputs<'tcx>( (trait_ref, sig.return_ty) } -pub fn iterator_trait_ref_and_outputs<'tcx>( +pub(crate) fn iterator_trait_ref_and_outputs<'tcx>( tcx: TyCtxt<'tcx>, iterator_def_id: DefId, self_ty: Ty<'tcx>, @@ -271,7 +271,7 @@ pub fn iterator_trait_ref_and_outputs<'tcx>( (trait_ref, sig.yield_ty) } -pub fn async_iterator_trait_ref_and_outputs<'tcx>( +pub(crate) fn async_iterator_trait_ref_and_outputs<'tcx>( tcx: TyCtxt<'tcx>, async_iterator_def_id: DefId, self_ty: Ty<'tcx>, @@ -287,7 +287,7 @@ pub fn impl_item_is_final(tcx: TyCtxt<'_>, assoc_item: &ty::AssocItem) -> bool { && tcx.defaultness(assoc_item.container_id(tcx)).is_final() } -pub enum TupleArgumentsFlag { +pub(crate) enum TupleArgumentsFlag { Yes, No, } diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs index ada2c8e81de5b..1118219824652 100644 --- a/compiler/rustc_traits/src/codegen.rs +++ b/compiler/rustc_traits/src/codegen.rs @@ -21,7 +21,7 @@ use tracing::debug; /// obligations *could be* resolved if we wanted to. /// /// This also expects that `trait_ref` is fully normalized. -pub fn codegen_select_candidate<'tcx>( +pub(crate) fn codegen_select_candidate<'tcx>( tcx: TyCtxt<'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::TraitRef<'tcx>), ) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> { diff --git a/compiler/rustc_traits/src/lib.rs b/compiler/rustc_traits/src/lib.rs index 697c839180312..d2f979bd6d9dc 100644 --- a/compiler/rustc_traits/src/lib.rs +++ b/compiler/rustc_traits/src/lib.rs @@ -2,6 +2,7 @@ // tidy-alphabetical-start #![recursion_limit = "256"] +#![warn(unreachable_pub)] // tidy-alphabetical-end mod codegen; diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 2c67e7d4847ac..c3fd771b79734 100644 --- a/compiler/rustc_transmute/src/layout/tree.rs +++ b/compiler/rustc_transmute/src/layout/tree.rs @@ -204,7 +204,7 @@ pub(crate) mod rustc { } impl<'tcx> Tree, Ref<'tcx>> { - pub fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result { + pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result { use rustc_target::abi::HasDataLayout; let layout = layout_of(cx, ty)?; diff --git a/compiler/rustc_transmute/src/layout/tree/tests.rs b/compiler/rustc_transmute/src/layout/tree/tests.rs index 3cb47517c2195..44f50a25c939a 100644 --- a/compiler/rustc_transmute/src/layout/tree/tests.rs +++ b/compiler/rustc_transmute/src/layout/tree/tests.rs @@ -1,7 +1,7 @@ use super::Tree; #[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)] -pub enum Def { +enum Def { NoSafetyInvariants, HasSafetyInvariants, } diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index bdc98bcea5eb0..c1d0b704ab287 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -2,6 +2,7 @@ #![allow(unused_variables)] #![feature(alloc_layout_extra)] #![feature(never_type)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set}; diff --git a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs index a76ef7f0d189b..95eaedbf04a5f 100644 --- a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs +++ b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs @@ -366,13 +366,13 @@ where } } -pub enum Quantifier { +enum Quantifier { ThereExists, ForAll, } impl Quantifier { - pub fn apply(&self, iter: I) -> Answer + fn apply(&self, iter: I) -> Answer where R: layout::Ref, I: IntoIterator>, diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/errors.rs index 42ecaaeafa905..5497d7d0bd2a0 100644 --- a/compiler/rustc_ty_utils/src/errors.rs +++ b/compiler/rustc_ty_utils/src/errors.rs @@ -7,14 +7,14 @@ use rustc_span::Span; #[derive(Diagnostic)] #[diag(ty_utils_needs_drop_overflow)] -pub struct NeedsDropOverflow<'tcx> { +pub(crate) struct NeedsDropOverflow<'tcx> { pub query_ty: Ty<'tcx>, } #[derive(Diagnostic)] #[diag(ty_utils_generic_constant_too_complex)] #[help] -pub struct GenericConstantTooComplex { +pub(crate) struct GenericConstantTooComplex { #[primary_span] pub span: Span, #[note(ty_utils_maybe_supported)] @@ -24,7 +24,7 @@ pub struct GenericConstantTooComplex { } #[derive(Subdiagnostic)] -pub enum GenericConstantTooComplexSub { +pub(crate) enum GenericConstantTooComplexSub { #[label(ty_utils_borrow_not_supported)] BorrowNotSupported(#[primary_span] Span), #[label(ty_utils_address_and_deref_not_supported)] @@ -71,40 +71,40 @@ pub enum GenericConstantTooComplexSub { #[derive(Diagnostic)] #[diag(ty_utils_unexpected_fnptr_associated_item)] -pub struct UnexpectedFnPtrAssociatedItem { +pub(crate) struct UnexpectedFnPtrAssociatedItem { #[primary_span] pub span: Span, } #[derive(Diagnostic)] #[diag(ty_utils_zero_length_simd_type)] -pub struct ZeroLengthSimdType<'tcx> { +pub(crate) struct ZeroLengthSimdType<'tcx> { pub ty: Ty<'tcx>, } #[derive(Diagnostic)] #[diag(ty_utils_multiple_array_fields_simd_type)] -pub struct MultipleArrayFieldsSimdType<'tcx> { +pub(crate) struct MultipleArrayFieldsSimdType<'tcx> { pub ty: Ty<'tcx>, } #[derive(Diagnostic)] #[diag(ty_utils_oversized_simd_type)] -pub struct OversizedSimdType<'tcx> { +pub(crate) struct OversizedSimdType<'tcx> { pub ty: Ty<'tcx>, pub max_lanes: u64, } #[derive(Diagnostic)] #[diag(ty_utils_non_primitive_simd_type)] -pub struct NonPrimitiveSimdType<'tcx> { +pub(crate) struct NonPrimitiveSimdType<'tcx> { pub ty: Ty<'tcx>, pub e_ty: Ty<'tcx>, } #[derive(Diagnostic)] #[diag(ty_utils_impl_trait_duplicate_arg)] -pub struct DuplicateArg<'tcx> { +pub(crate) struct DuplicateArg<'tcx> { pub arg: GenericArg<'tcx>, #[primary_span] #[label] @@ -115,7 +115,7 @@ pub struct DuplicateArg<'tcx> { #[derive(Diagnostic)] #[diag(ty_utils_impl_trait_not_param, code = E0792)] -pub struct NotParam<'tcx> { +pub(crate) struct NotParam<'tcx> { pub arg: GenericArg<'tcx>, #[primary_span] #[label] diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index ad0bcbfbbc2ac..dc5303317a8a0 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -16,6 +16,7 @@ #![feature(let_chains)] #![feature(never_type)] #![feature(rustdoc_internals)] +#![warn(unreachable_pub)] // tidy-alphabetical-end use rustc_middle::query::Providers; diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs index 8e3534b0e9eb4..f49aa3431b5c0 100644 --- a/compiler/rustc_type_ir/src/fold.rs +++ b/compiler/rustc_type_ir/src/fold.rs @@ -354,7 +354,7 @@ struct Shifter { } impl Shifter { - pub fn new(cx: I, amount: u32) -> Self { + fn new(cx: I, amount: u32) -> Self { Shifter { cx, current_index: ty::INNERMOST, amount } } } diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index f763153a5fc88..be261b348de52 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -6,6 +6,7 @@ )] #![cfg_attr(feature = "nightly", allow(internal_features))] #![cfg_attr(not(bootstrap), allow(rustc::usage_of_type_ir_inherent))] +#![warn(unreachable_pub)] // tidy-alphabetical-end extern crate self as rustc_type_ir;