From 19843bba64adda8194aa983fd7d1397517f5efe6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 10:28:52 +1000 Subject: [PATCH 01/13] Add `warn(unreachable_pub)` to `rustc_sanitizers`. --- .../src/cfi/typeid/itanium_cxx_abi/encode.rs | 6 +++--- .../src/cfi/typeid/itanium_cxx_abi/transform.rs | 6 +++--- compiler/rustc_sanitizers/src/lib.rs | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) 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 a4e4f50e8f2..45057a3530c 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 2f43199796c..8db0d358537 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 e4792563e71..55be931bcd6 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; From 21a37da26840ae34a02246ea9141b28efd6e8ce5 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 10:45:32 +1000 Subject: [PATCH 02/13] Add `warn(unreachable_pub)` to `rustc_serialize`. --- compiler/rustc_serialize/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index f0e1630c650..b7977a848ce 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}; From 19ff6e6e63a22dbccc86ee0c78d2baddb91bda03 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 11:02:18 +1000 Subject: [PATCH 03/13] Add `warn(unreachable_pub)` to `rustc_session`. --- compiler/rustc_session/src/lib.rs | 1 + compiler/rustc_session/src/options.rs | 142 +++++++++++++------------- 2 files changed, 74 insertions(+), 69 deletions(-) diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index d93b3eac080..7e059a88c27 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 37077901e0c..45339c23ea3 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`)"; } From b457ab31860b9c92fd2a52c7a2ca328a04cdfa23 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 12:59:35 +1000 Subject: [PATCH 04/13] Add `warn(unreachable_pub)` to `rustc_smir`. --- compiler/rustc_smir/src/lib.rs | 1 + compiler/rustc_smir/src/rustc_smir/alloc.rs | 4 ++-- compiler/rustc_smir/src/rustc_smir/builder.rs | 6 +++--- compiler/rustc_smir/src/rustc_smir/context.rs | 2 +- compiler/rustc_smir/src/rustc_smir/convert/mod.rs | 2 +- compiler/rustc_smir/src/rustc_smir/convert/ty.rs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_smir/src/lib.rs index 9f888875306..2215e2f01ad 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 677b4c7a9c0..11fbc005e37 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 883ab7c18b4..cd91fc26c10 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 f9663f2dd30..a4ede374a19 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 50687935473..c9795fca399 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 9afd732486c..efbb0f244fc 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>, From b0f22ff98ff345aa7daf8c2f67d5b55f721c366a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 13:15:02 +1000 Subject: [PATCH 05/13] Add `warn(unreachable_pub)` to `rustc_span`. --- compiler/rustc_span/src/analyze_source_file.rs | 2 +- compiler/rustc_span/src/lib.rs | 1 + compiler/rustc_span/src/span_encoding.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs index ba7e0cec5bd..28ce883daee 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 7b020f11cdd..45dca3af6c0 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 8988becb171..3047abfbb5c 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, } From 89deb3c7420bf5a3643a53132cca4e1d9e0ebc80 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 13:21:53 +1000 Subject: [PATCH 06/13] Add `warn(unreachable_pub)` to `rustc_symbol_mangling`. --- compiler/rustc_symbol_mangling/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs index dea4eb08c76..0c97cda81c8 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; From 0fb3a509cf437610b4329003de5bc1552aa7e540 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 14:22:46 +1000 Subject: [PATCH 07/13] Add `warn(unreachable_pub)` to `rustc_target`. --- compiler/rustc_target/src/abi/call/aarch64.rs | 4 +-- compiler/rustc_target/src/abi/call/amdgpu.rs | 2 +- compiler/rustc_target/src/abi/call/arm.rs | 2 +- compiler/rustc_target/src/abi/call/avr.rs | 2 +- compiler/rustc_target/src/abi/call/bpf.rs | 2 +- compiler/rustc_target/src/abi/call/csky.rs | 2 +- compiler/rustc_target/src/abi/call/hexagon.rs | 2 +- .../rustc_target/src/abi/call/loongarch.rs | 2 +- compiler/rustc_target/src/abi/call/m68k.rs | 2 +- compiler/rustc_target/src/abi/call/mips.rs | 2 +- compiler/rustc_target/src/abi/call/mips64.rs | 2 +- compiler/rustc_target/src/abi/call/msp430.rs | 2 +- compiler/rustc_target/src/abi/call/nvptx64.rs | 4 +-- compiler/rustc_target/src/abi/call/powerpc.rs | 2 +- .../rustc_target/src/abi/call/powerpc64.rs | 2 +- compiler/rustc_target/src/abi/call/riscv.rs | 2 +- compiler/rustc_target/src/abi/call/s390x.rs | 2 +- compiler/rustc_target/src/abi/call/sparc.rs | 2 +- compiler/rustc_target/src/abi/call/sparc64.rs | 4 +-- compiler/rustc_target/src/abi/call/wasm.rs | 4 +-- compiler/rustc_target/src/abi/call/x86.rs | 4 +-- compiler/rustc_target/src/abi/call/x86_64.rs | 2 +- .../rustc_target/src/abi/call/x86_win64.rs | 2 +- compiler/rustc_target/src/abi/call/xtensa.rs | 2 +- compiler/rustc_target/src/asm/aarch64.rs | 2 +- compiler/rustc_target/src/lib.rs | 1 + compiler/rustc_target/src/spec/base/aix.rs | 2 +- .../rustc_target/src/spec/base/android.rs | 2 +- .../rustc_target/src/spec/base/apple/mod.rs | 30 +++++++++---------- .../rustc_target/src/spec/base/avr_gnu.rs | 2 +- compiler/rustc_target/src/spec/base/bpf.rs | 2 +- .../rustc_target/src/spec/base/dragonfly.rs | 2 +- .../rustc_target/src/spec/base/freebsd.rs | 2 +- .../rustc_target/src/spec/base/fuchsia.rs | 2 +- compiler/rustc_target/src/spec/base/haiku.rs | 2 +- compiler/rustc_target/src/spec/base/hermit.rs | 2 +- compiler/rustc_target/src/spec/base/hurd.rs | 2 +- .../rustc_target/src/spec/base/hurd_gnu.rs | 2 +- .../rustc_target/src/spec/base/illumos.rs | 2 +- compiler/rustc_target/src/spec/base/l4re.rs | 2 +- compiler/rustc_target/src/spec/base/linux.rs | 2 +- .../rustc_target/src/spec/base/linux_gnu.rs | 2 +- .../rustc_target/src/spec/base/linux_musl.rs | 2 +- .../rustc_target/src/spec/base/linux_ohos.rs | 2 +- .../src/spec/base/linux_uclibc.rs | 2 +- compiler/rustc_target/src/spec/base/msvc.rs | 2 +- compiler/rustc_target/src/spec/base/netbsd.rs | 2 +- .../rustc_target/src/spec/base/nto_qnx.rs | 2 +- .../rustc_target/src/spec/base/openbsd.rs | 2 +- compiler/rustc_target/src/spec/base/redox.rs | 2 +- .../rustc_target/src/spec/base/solaris.rs | 2 +- compiler/rustc_target/src/spec/base/solid.rs | 2 +- compiler/rustc_target/src/spec/base/teeos.rs | 2 +- compiler/rustc_target/src/spec/base/thumb.rs | 2 +- .../rustc_target/src/spec/base/uefi_msvc.rs | 2 +- .../src/spec/base/unikraft_linux_musl.rs | 2 +- .../rustc_target/src/spec/base/vxworks.rs | 2 +- compiler/rustc_target/src/spec/base/wasm.rs | 2 +- .../rustc_target/src/spec/base/windows_gnu.rs | 2 +- .../src/spec/base/windows_gnullvm.rs | 2 +- .../src/spec/base/windows_msvc.rs | 2 +- .../src/spec/base/windows_uwp_gnu.rs | 2 +- .../src/spec/base/windows_uwp_msvc.rs | 2 +- compiler/rustc_target/src/spec/base/xtensa.rs | 2 +- .../src/spec/targets/aarch64_apple_darwin.rs | 2 +- .../src/spec/targets/aarch64_apple_ios.rs | 2 +- .../spec/targets/aarch64_apple_ios_macabi.rs | 2 +- .../src/spec/targets/aarch64_apple_ios_sim.rs | 2 +- .../src/spec/targets/aarch64_apple_tvos.rs | 2 +- .../spec/targets/aarch64_apple_tvos_sim.rs | 2 +- .../spec/targets/aarch64_apple_visionos.rs | 2 +- .../targets/aarch64_apple_visionos_sim.rs | 2 +- .../src/spec/targets/aarch64_apple_watchos.rs | 2 +- .../spec/targets/aarch64_apple_watchos_sim.rs | 2 +- .../targets/aarch64_be_unknown_linux_gnu.rs | 2 +- .../aarch64_be_unknown_linux_gnu_ilp32.rs | 2 +- .../spec/targets/aarch64_be_unknown_netbsd.rs | 2 +- .../src/spec/targets/aarch64_fuchsia.rs | 2 +- .../spec/targets/aarch64_kmc_solid_asp3.rs | 2 +- .../src/spec/targets/aarch64_linux_android.rs | 2 +- .../aarch64_nintendo_switch_freestanding.rs | 2 +- .../targets/aarch64_pc_windows_gnullvm.rs | 2 +- .../spec/targets/aarch64_pc_windows_msvc.rs | 2 +- .../spec/targets/aarch64_unknown_freebsd.rs | 2 +- .../spec/targets/aarch64_unknown_fuchsia.rs | 2 +- .../spec/targets/aarch64_unknown_hermit.rs | 2 +- .../spec/targets/aarch64_unknown_illumos.rs | 2 +- .../spec/targets/aarch64_unknown_linux_gnu.rs | 2 +- .../aarch64_unknown_linux_gnu_ilp32.rs | 2 +- .../targets/aarch64_unknown_linux_musl.rs | 2 +- .../targets/aarch64_unknown_linux_ohos.rs | 2 +- .../spec/targets/aarch64_unknown_netbsd.rs | 2 +- .../src/spec/targets/aarch64_unknown_none.rs | 2 +- .../targets/aarch64_unknown_none_softfloat.rs | 2 +- .../targets/aarch64_unknown_nto_qnx700.rs | 2 +- .../targets/aarch64_unknown_nto_qnx710.rs | 2 +- .../spec/targets/aarch64_unknown_openbsd.rs | 2 +- .../src/spec/targets/aarch64_unknown_redox.rs | 2 +- .../src/spec/targets/aarch64_unknown_teeos.rs | 2 +- .../spec/targets/aarch64_unknown_trusty.rs | 2 +- .../src/spec/targets/aarch64_unknown_uefi.rs | 2 +- .../spec/targets/aarch64_uwp_windows_msvc.rs | 2 +- .../src/spec/targets/aarch64_wrs_vxworks.rs | 2 +- .../spec/targets/arm64_32_apple_watchos.rs | 2 +- .../src/spec/targets/arm64e_apple_darwin.rs | 2 +- .../src/spec/targets/arm64e_apple_ios.rs | 2 +- .../spec/targets/arm64ec_pc_windows_msvc.rs | 2 +- .../src/spec/targets/arm_linux_androideabi.rs | 2 +- .../spec/targets/arm_unknown_linux_gnueabi.rs | 2 +- .../targets/arm_unknown_linux_gnueabihf.rs | 2 +- .../targets/arm_unknown_linux_musleabi.rs | 2 +- .../targets/arm_unknown_linux_musleabihf.rs | 2 +- .../targets/armeb_unknown_linux_gnueabi.rs | 2 +- .../src/spec/targets/armebv7r_none_eabi.rs | 2 +- .../src/spec/targets/armebv7r_none_eabihf.rs | 2 +- .../src/spec/targets/armv4t_none_eabi.rs | 2 +- .../targets/armv4t_unknown_linux_gnueabi.rs | 2 +- .../src/spec/targets/armv5te_none_eabi.rs | 2 +- .../targets/armv5te_unknown_linux_gnueabi.rs | 2 +- .../targets/armv5te_unknown_linux_musleabi.rs | 2 +- .../armv5te_unknown_linux_uclibceabi.rs | 2 +- .../src/spec/targets/armv6_unknown_freebsd.rs | 2 +- .../targets/armv6_unknown_netbsd_eabihf.rs | 2 +- .../src/spec/targets/armv6k_nintendo_3ds.rs | 2 +- .../spec/targets/armv7_linux_androideabi.rs | 2 +- .../targets/armv7_sony_vita_newlibeabihf.rs | 2 +- .../src/spec/targets/armv7_unknown_freebsd.rs | 2 +- .../targets/armv7_unknown_linux_gnueabi.rs | 2 +- .../targets/armv7_unknown_linux_gnueabihf.rs | 2 +- .../targets/armv7_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabihf.rs | 2 +- .../spec/targets/armv7_unknown_linux_ohos.rs | 2 +- .../targets/armv7_unknown_linux_uclibceabi.rs | 2 +- .../armv7_unknown_linux_uclibceabihf.rs | 2 +- .../targets/armv7_unknown_netbsd_eabihf.rs | 2 +- .../src/spec/targets/armv7_unknown_trusty.rs | 2 +- .../spec/targets/armv7_wrs_vxworks_eabihf.rs | 2 +- .../targets/armv7a_kmc_solid_asp3_eabi.rs | 2 +- .../targets/armv7a_kmc_solid_asp3_eabihf.rs | 2 +- .../src/spec/targets/armv7a_none_eabi.rs | 2 +- .../src/spec/targets/armv7a_none_eabihf.rs | 2 +- .../src/spec/targets/armv7k_apple_watchos.rs | 2 +- .../src/spec/targets/armv7r_none_eabi.rs | 2 +- .../src/spec/targets/armv7r_none_eabihf.rs | 2 +- .../src/spec/targets/armv7s_apple_ios.rs | 2 +- .../src/spec/targets/armv8r_none_eabihf.rs | 2 +- .../spec/targets/avr_unknown_gnu_atmega328.rs | 2 +- .../src/spec/targets/bpfeb_unknown_none.rs | 2 +- .../src/spec/targets/bpfel_unknown_none.rs | 2 +- .../targets/csky_unknown_linux_gnuabiv2.rs | 2 +- .../targets/csky_unknown_linux_gnuabiv2hf.rs | 2 +- .../targets/hexagon_unknown_linux_musl.rs | 2 +- .../spec/targets/hexagon_unknown_none_elf.rs | 2 +- .../src/spec/targets/i386_apple_ios.rs | 2 +- .../src/spec/targets/i586_pc_nto_qnx700.rs | 2 +- .../src/spec/targets/i586_pc_windows_msvc.rs | 2 +- .../spec/targets/i586_unknown_linux_gnu.rs | 2 +- .../spec/targets/i586_unknown_linux_musl.rs | 2 +- .../src/spec/targets/i586_unknown_netbsd.rs | 2 +- .../src/spec/targets/i686_apple_darwin.rs | 2 +- .../src/spec/targets/i686_linux_android.rs | 2 +- .../src/spec/targets/i686_pc_windows_gnu.rs | 2 +- .../spec/targets/i686_pc_windows_gnullvm.rs | 2 +- .../src/spec/targets/i686_pc_windows_msvc.rs | 2 +- .../src/spec/targets/i686_unknown_freebsd.rs | 2 +- .../src/spec/targets/i686_unknown_haiku.rs | 2 +- .../src/spec/targets/i686_unknown_hurd_gnu.rs | 2 +- .../spec/targets/i686_unknown_linux_gnu.rs | 2 +- .../spec/targets/i686_unknown_linux_musl.rs | 2 +- .../src/spec/targets/i686_unknown_netbsd.rs | 2 +- .../src/spec/targets/i686_unknown_openbsd.rs | 2 +- .../src/spec/targets/i686_unknown_redox.rs | 2 +- .../src/spec/targets/i686_unknown_uefi.rs | 2 +- .../src/spec/targets/i686_uwp_windows_gnu.rs | 2 +- .../src/spec/targets/i686_uwp_windows_msvc.rs | 2 +- .../spec/targets/i686_win7_windows_msvc.rs | 2 +- .../src/spec/targets/i686_wrs_vxworks.rs | 2 +- .../targets/loongarch64_unknown_linux_gnu.rs | 2 +- .../targets/loongarch64_unknown_linux_musl.rs | 2 +- .../spec/targets/loongarch64_unknown_none.rs | 2 +- .../loongarch64_unknown_none_softfloat.rs | 2 +- .../spec/targets/m68k_unknown_linux_gnu.rs | 2 +- .../spec/targets/mips64_openwrt_linux_musl.rs | 2 +- .../targets/mips64_unknown_linux_gnuabi64.rs | 2 +- .../targets/mips64_unknown_linux_muslabi64.rs | 2 +- .../mips64el_unknown_linux_gnuabi64.rs | 2 +- .../mips64el_unknown_linux_muslabi64.rs | 2 +- .../spec/targets/mips_unknown_linux_gnu.rs | 2 +- .../spec/targets/mips_unknown_linux_musl.rs | 2 +- .../spec/targets/mips_unknown_linux_uclibc.rs | 2 +- .../src/spec/targets/mipsel_sony_psp.rs | 2 +- .../src/spec/targets/mipsel_sony_psx.rs | 2 +- .../spec/targets/mipsel_unknown_linux_gnu.rs | 2 +- .../spec/targets/mipsel_unknown_linux_musl.rs | 2 +- .../targets/mipsel_unknown_linux_uclibc.rs | 2 +- .../src/spec/targets/mipsel_unknown_netbsd.rs | 2 +- .../src/spec/targets/mipsel_unknown_none.rs | 2 +- .../targets/mipsisa32r6_unknown_linux_gnu.rs | 2 +- .../mipsisa32r6el_unknown_linux_gnu.rs | 2 +- .../mipsisa64r6_unknown_linux_gnuabi64.rs | 2 +- .../mipsisa64r6el_unknown_linux_gnuabi64.rs | 2 +- .../src/spec/targets/msp430_none_elf.rs | 2 +- .../src/spec/targets/nvptx64_nvidia_cuda.rs | 2 +- .../src/spec/targets/powerpc64_ibm_aix.rs | 2 +- .../spec/targets/powerpc64_unknown_freebsd.rs | 2 +- .../targets/powerpc64_unknown_linux_gnu.rs | 2 +- .../targets/powerpc64_unknown_linux_musl.rs | 2 +- .../spec/targets/powerpc64_unknown_openbsd.rs | 2 +- .../src/spec/targets/powerpc64_wrs_vxworks.rs | 2 +- .../targets/powerpc64le_unknown_freebsd.rs | 2 +- .../targets/powerpc64le_unknown_linux_gnu.rs | 2 +- .../targets/powerpc64le_unknown_linux_musl.rs | 2 +- .../spec/targets/powerpc_unknown_freebsd.rs | 2 +- .../spec/targets/powerpc_unknown_linux_gnu.rs | 2 +- .../targets/powerpc_unknown_linux_gnuspe.rs | 2 +- .../targets/powerpc_unknown_linux_musl.rs | 2 +- .../targets/powerpc_unknown_linux_muslspe.rs | 2 +- .../spec/targets/powerpc_unknown_netbsd.rs | 2 +- .../spec/targets/powerpc_unknown_openbsd.rs | 2 +- .../src/spec/targets/powerpc_wrs_vxworks.rs | 2 +- .../spec/targets/powerpc_wrs_vxworks_spe.rs | 2 +- .../targets/riscv32gc_unknown_linux_gnu.rs | 2 +- .../targets/riscv32gc_unknown_linux_musl.rs | 2 +- .../spec/targets/riscv32i_unknown_none_elf.rs | 2 +- .../spec/targets/riscv32im_risc0_zkvm_elf.rs | 2 +- .../targets/riscv32im_unknown_none_elf.rs | 2 +- .../targets/riscv32ima_unknown_none_elf.rs | 2 +- .../spec/targets/riscv32imac_esp_espidf.rs | 2 +- .../targets/riscv32imac_unknown_none_elf.rs | 2 +- .../targets/riscv32imac_unknown_nuttx_elf.rs | 2 +- .../targets/riscv32imac_unknown_xous_elf.rs | 2 +- .../spec/targets/riscv32imafc_esp_espidf.rs | 2 +- .../targets/riscv32imafc_unknown_none_elf.rs | 2 +- .../targets/riscv32imafc_unknown_nuttx_elf.rs | 2 +- .../src/spec/targets/riscv32imc_esp_espidf.rs | 2 +- .../targets/riscv32imc_unknown_none_elf.rs | 2 +- .../targets/riscv32imc_unknown_nuttx_elf.rs | 2 +- .../src/spec/targets/riscv64_linux_android.rs | 2 +- .../spec/targets/riscv64gc_unknown_freebsd.rs | 2 +- .../spec/targets/riscv64gc_unknown_fuchsia.rs | 2 +- .../spec/targets/riscv64gc_unknown_hermit.rs | 2 +- .../targets/riscv64gc_unknown_linux_gnu.rs | 2 +- .../targets/riscv64gc_unknown_linux_musl.rs | 2 +- .../spec/targets/riscv64gc_unknown_netbsd.rs | 2 +- .../targets/riscv64gc_unknown_none_elf.rs | 2 +- .../targets/riscv64gc_unknown_nuttx_elf.rs | 2 +- .../spec/targets/riscv64gc_unknown_openbsd.rs | 2 +- .../targets/riscv64imac_unknown_none_elf.rs | 2 +- .../targets/riscv64imac_unknown_nuttx_elf.rs | 2 +- .../spec/targets/s390x_unknown_linux_gnu.rs | 2 +- .../spec/targets/s390x_unknown_linux_musl.rs | 2 +- .../spec/targets/sparc64_unknown_linux_gnu.rs | 2 +- .../spec/targets/sparc64_unknown_netbsd.rs | 2 +- .../spec/targets/sparc64_unknown_openbsd.rs | 2 +- .../spec/targets/sparc_unknown_linux_gnu.rs | 2 +- .../spec/targets/sparc_unknown_none_elf.rs | 2 +- .../src/spec/targets/sparcv9_sun_solaris.rs | 2 +- .../src/spec/targets/thumbv4t_none_eabi.rs | 2 +- .../src/spec/targets/thumbv5te_none_eabi.rs | 2 +- .../src/spec/targets/thumbv6m_none_eabi.rs | 2 +- .../src/spec/targets/thumbv6m_nuttx_eabi.rs | 2 +- .../spec/targets/thumbv7a_pc_windows_msvc.rs | 2 +- .../spec/targets/thumbv7a_uwp_windows_msvc.rs | 2 +- .../src/spec/targets/thumbv7em_none_eabi.rs | 2 +- .../src/spec/targets/thumbv7em_none_eabihf.rs | 2 +- .../src/spec/targets/thumbv7em_nuttx_eabi.rs | 2 +- .../spec/targets/thumbv7em_nuttx_eabihf.rs | 2 +- .../src/spec/targets/thumbv7m_none_eabi.rs | 2 +- .../src/spec/targets/thumbv7m_nuttx_eabi.rs | 2 +- .../targets/thumbv7neon_linux_androideabi.rs | 2 +- .../thumbv7neon_unknown_linux_gnueabihf.rs | 2 +- .../thumbv7neon_unknown_linux_musleabihf.rs | 2 +- .../spec/targets/thumbv8m_base_none_eabi.rs | 2 +- .../spec/targets/thumbv8m_base_nuttx_eabi.rs | 2 +- .../spec/targets/thumbv8m_main_none_eabi.rs | 2 +- .../spec/targets/thumbv8m_main_none_eabihf.rs | 2 +- .../spec/targets/thumbv8m_main_nuttx_eabi.rs | 2 +- .../targets/thumbv8m_main_nuttx_eabihf.rs | 2 +- .../spec/targets/wasm32_unknown_emscripten.rs | 2 +- .../spec/targets/wasm32_unknown_unknown.rs | 2 +- .../src/spec/targets/wasm32_wasi.rs | 2 +- .../src/spec/targets/wasm32_wasip1.rs | 2 +- .../src/spec/targets/wasm32_wasip1_threads.rs | 2 +- .../src/spec/targets/wasm32_wasip2.rs | 2 +- .../spec/targets/wasm64_unknown_unknown.rs | 2 +- .../src/spec/targets/x86_64_apple_darwin.rs | 2 +- .../src/spec/targets/x86_64_apple_ios.rs | 2 +- .../spec/targets/x86_64_apple_ios_macabi.rs | 2 +- .../src/spec/targets/x86_64_apple_tvos.rs | 2 +- .../spec/targets/x86_64_apple_watchos_sim.rs | 2 +- .../targets/x86_64_fortanix_unknown_sgx.rs | 2 +- .../src/spec/targets/x86_64_fuchsia.rs | 2 +- .../src/spec/targets/x86_64_linux_android.rs | 2 +- .../src/spec/targets/x86_64_pc_nto_qnx710.rs | 2 +- .../src/spec/targets/x86_64_pc_solaris.rs | 2 +- .../src/spec/targets/x86_64_pc_windows_gnu.rs | 2 +- .../spec/targets/x86_64_pc_windows_gnullvm.rs | 2 +- .../spec/targets/x86_64_pc_windows_msvc.rs | 2 +- .../targets/x86_64_unikraft_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_dragonfly.rs | 2 +- .../spec/targets/x86_64_unknown_freebsd.rs | 2 +- .../spec/targets/x86_64_unknown_fuchsia.rs | 2 +- .../src/spec/targets/x86_64_unknown_haiku.rs | 2 +- .../src/spec/targets/x86_64_unknown_hermit.rs | 2 +- .../spec/targets/x86_64_unknown_illumos.rs | 2 +- .../targets/x86_64_unknown_l4re_uclibc.rs | 2 +- .../spec/targets/x86_64_unknown_linux_gnu.rs | 2 +- .../targets/x86_64_unknown_linux_gnux32.rs | 2 +- .../spec/targets/x86_64_unknown_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_linux_none.rs | 2 +- .../spec/targets/x86_64_unknown_linux_ohos.rs | 2 +- .../src/spec/targets/x86_64_unknown_netbsd.rs | 2 +- .../src/spec/targets/x86_64_unknown_none.rs | 2 +- .../spec/targets/x86_64_unknown_openbsd.rs | 2 +- .../src/spec/targets/x86_64_unknown_redox.rs | 2 +- .../src/spec/targets/x86_64_unknown_uefi.rs | 2 +- .../spec/targets/x86_64_uwp_windows_gnu.rs | 2 +- .../spec/targets/x86_64_uwp_windows_msvc.rs | 2 +- .../spec/targets/x86_64_win7_windows_msvc.rs | 2 +- .../src/spec/targets/x86_64_wrs_vxworks.rs | 2 +- .../src/spec/targets/x86_64h_apple_darwin.rs | 2 +- .../src/spec/targets/xtensa_esp32_espidf.rs | 2 +- .../src/spec/targets/xtensa_esp32_none_elf.rs | 2 +- .../src/spec/targets/xtensa_esp32s2_espidf.rs | 2 +- .../spec/targets/xtensa_esp32s2_none_elf.rs | 2 +- .../src/spec/targets/xtensa_esp32s3_espidf.rs | 2 +- .../spec/targets/xtensa_esp32s3_none_elf.rs | 2 +- 327 files changed, 346 insertions(+), 345 deletions(-) diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs index 04020d13f22..55b65fb1caa 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 e30dead63cb..3007a729a8b 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 9371e1b3958..bd6f781fb81 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 b01dac8c70d..dfc991e0954 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 780e7df4383..f19772ac709 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 7951f28beea..b1c1ae814a7 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 80a442048d5..0a0688880c0 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 893818af77c..4a21935623b 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 06697bdd83e..b6bd68b66fc 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 0e5a7f37a09..37980a91c76 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 5b52ebbdedd..2c3258c8d42 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 33ef47be009..4f613aa6c15 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 27d197af792..2e8b16d3a93 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 8f67f57cd2b..f3b05c48173 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 749eea0ef63..b9767bf906b 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 84f13f8cc5d..be6bc701b49 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 901ce139c7b..502e7331267 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 0e5a7f37a09..37980a91c76 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 311691d8efb..2954d9642df 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 a773fb1e814..4ae8b9490dd 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 e9aedc3d28a..bdb14350ded 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 fcd712489fa..1209204debf 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 720707ef53f..e5a20b248e4 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 addbe698925..a1c5e8230cc 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 daf5162e8ac..74970a26b23 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 b2116c51216..d7c66d6f5e3 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 c71c4ba2cc9..e7e9ec663c4 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 5320f1b4bbb..dfa0e3fe989 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 39d7cf7d097..b752a344395 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 c3d0344ea6c..dd9fc32b69e 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 4d03747d016..17d5e75ef6d 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 3c1846696f7..5da23f2b8fd 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 c772754aa8d..a016489e52d 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 d1ac22f3a09..fc3d9f6fb9f 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 8ab874410aa..d90e4c99f93 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 c6e98fc1a11..971abef80d9 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 76f8223c0e4..d464d50ecc2 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 3501dbdea1b..70d423217a6 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 f0a648b93ad..fa743a0c66d 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 3a4d83fad17..dbe9e78a193 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 34b2eb0f641..2e30364525e 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 3491277c440..1200add4fe1 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 42aa1e1a6da..a29635112ff 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 8272cda05e7..2372bc2c718 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 540344e9e94..80a6479bb5f 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 720cf03005a..b0fb2ef4b27 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 495e3d10fbc..1ae81eb0633 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 f1405e9b446..47177415b39 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 bc3aecb5c1e..942ac4a393c 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 9070791e9df..3f13f1f8841 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 f97cdb4fb28..1529cd65b28 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 ce4a8869001..fd55e1d1501 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 38d0a6d7314..94eb946dda4 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 0decfecb4cd..03ec679038c 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 e8acd6078e2..0020106f40e 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 9ccd0a1e7ca..fd813815724 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 aa4784b63e7..425dd3c8cc2 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 f237391016e..e417137ced1 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 7346e42dd91..1393b159184 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 88c3b8a81ad..9e89a3c75fe 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 bd0318f3183..5301e3ff654 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 17256e18e24..8134b5feade 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 59a76167125..f4f71214504 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 31ad09c52e4..280dd16e264 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 65f2a1e3069..912392c9fef 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 11a39c26e9d..7f3a86f3256 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 32c2367d5bf..e60eeda4295 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 703b886cc19..d605e22701a 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 e97ad11cdf6..fc774ab94c8 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 8bfa9c8e8b7..8e8bb1efc9d 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 b0798e5e4f5..16c7d72daed 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 7b2d2b6a8e4..42973e0268e 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 6d66299d6d9..03fc2518d1d 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 9675a950d5d..13e2b961794 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 df389fe34bd..5b8efd66262 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 10a8e3e4df8..c14fa20b697 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 ba646cd6065..fe4dadfe838 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 3668db912bb..144ac85622e 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 1c2273bb3a1..1d054dad568 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 3f0072c00c1..ff0a0762e3c 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 1ba4fbb3d25..d6d49a4a070 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 070460538c7..9d10358a49f 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 f4e2ee44805..c3bd2ea6c33 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 b10f1c7592e..b993275ff83 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 f84853fbb19..b462739e561 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 55cb0b8f2ee..e9da6a8f3ce 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 7f05358e016..bed9c88fd67 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 1a45c2c5c05..56709f788d3 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 851366b7647..71b331972cc 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 6b4a422a474..1cf71b65040 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 726a85c81f3..0dbf4cb7a70 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 0069d5431f8..e25beec0a13 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 169468f2e24..54a08853c28 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 222d5651b52..7933041b584 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 ac1bec02ec8..47a9b91663f 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 65a1863eb39..5b5a21fca95 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 e16991af4e6..8f6215df71a 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 e59b38a3e41..26c1a671095 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 5ae2d68332c..4e3d5ce34bc 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 9fd7c246498..69ab992e12c 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 429303170b6..bb580af7c47 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 df1b75272b1..630658efd06 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 41f7532ecdb..3c0f92fa31f 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 2c76f4736de..f292ee7f563 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 6f28f5d0543..e86b8358a9c 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 1590ae9679d..fcb850f44bc 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 21cb38868fb..50c399bf4a8 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 a22bcef4757..350a01b1967 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 8ff272e786d..296f9d0b423 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 e3e2f4cd05c..5d58055f1af 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 f958b89358b..89a80ae8bed 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 98093fdc003..200bb917964 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 b56f311793a..a6ea48817c0 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 df32b74f6d9..d09624e0e73 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 063038c8012..10669dcf09d 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 f873fb0d349..2236e02d006 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 18f327bc87f..d88022ac10a 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 1fbe4b89ea1..3d8e75d3ee9 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 12368644837..a73d8298dde 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 ccbc1e36dde..91b0e2039c7 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 d88b88333b5..65658ab45fc 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 24e9d1e0394..52617237f20 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 62e328b9cbd..eda1c028aad 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 bcdad0a55b3..b29ee2dd793 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 8f6a58a1b49..3bba22f8a1f 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 a9b5172385b..5f71d325efb 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 3a16bbe95db..b955acd0dca 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 8a4ba271456..703a9b132b2 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 a217a2daeb3..db79810b5dd 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 96459a5137f..e4e99eab853 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 6c878141fd4..5fc3f703175 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 bffc51d9b7b..040a953b12e 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 9dc1221287d..af10d2d9012 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 01a1468d3a8..53673daa812 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 a2391503ff8..164acd17f21 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 889cc201569..1ad91b8f080 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 7d60ec1b64d..f8faec918e4 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 76d4653931b..aea897f56b8 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 d2b4d46adac..be526d63250 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 b544c404f3f..1e4798abfff 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 aebb7e667bc..ab8b870c628 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 e876c567b09..35de6b35eaf 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 b3246dc7928..aba55f533a7 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 9ac500d7ffe..5a8519dcc49 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 11608794932..41eaa79d3eb 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 ee940c3a76a..042a9a14071 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 bf01413a80a..020322b2739 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 eb223af8cf4..f4c3a35ced5 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 12164adc00f..6ef72c40210 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 e8a0b465e15..61c246fc4cb 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 99330ddc318..91c33caae3e 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 bd539799029..cddc3a33f9f 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 cefd0bf6d67..730b19abd2b 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 b1b2b6cdffa..263393fd536 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 6c80ab6994d..cf0577d8cb0 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 befb0f89f3b..dd38f86bced 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 b699a7af177..e481e967ebf 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 55a26eb004a..623422a89ea 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 de42549b7f8..3c5ba157c1e 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 02f6bec4692..f173e8b7e4a 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 fc313e575be..bce41976a96 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 4b0f4bf3ecd..7288359f564 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 5bb08201429..a38e67b96f0 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 970b43ad109..a8e1ad45014 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 cce21fcacb1..8ba58dfd705 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 84ef00f06c8..b2316fd3bf4 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 ad8c0f7f582..2e303ff402f 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 5584435a0ad..15bc4da1775 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 d1ab1f73b51..8dd08a9567b 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 255148fca9a..02a95ee6626 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 d6df801234c..b8c9efc7c47 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 83252fadb78..0e00249d66c 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 b92fc2e759a..3cda78003ed 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 851bea80fb8..901c9fc378d 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 28bd2aae8e7..c7703666ae0 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 cd488d0532c..79302cdc0a1 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 973c75eeca6..ba669334e7f 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 6f0bb449c16..d33c7af92c6 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 f7a6e0bd857..5540e71ad4f 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 c7f47da6972..56285190268 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 21e4f4a2b05..7e57715ce7a 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 7cff0efd112..9d9f6145e2f 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 c3235bf994f..72577749ac6 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 cdf4ffb7f9e..1fad6be2f8d 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 463f7dc47f7..7627131bc2f 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 ad77a02c063..f93e5676b05 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 83f5c7ea37d..6fbb4f40024 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 0bdfd6ee6b0..778b0041214 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 8e27c9936c5..2cce3271c57 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 852e1d9376d..ef7d6bf82e3 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 9d3f4d9f795..850808b4c7b 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 c0b99a68b0d..761495b2a29 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 8fe4548a3ad..2784b371469 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 43914a23308..1b2d8e9a105 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 6150654c081..21f03a40ec2 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 03501aa76a8..ea2fb2e7f3a 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 81aac3ce0b8..bb8eb24908c 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 2ed520e9f48..5c07e9ea6dd 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 de30c5b35b7..63b3cc47ffc 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 4178a991e14..7f5e2edb036 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 8e50373bd12..a2d807bcfe1 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 de476741def..5bc5f79d1b6 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 ec5edfb6e42..289251e906a 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 bda43e7a2b0..0f90efb4bb3 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 6eb5bba0fcd..89afe234376 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 53b84479a49..e39849c9b18 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 0d0484dd174..24a56f917e5 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 2922c921e17..1dab74e9376 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 dd2ec274207..1029a135e4a 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 ea295cf169e..3c9d01e2d18 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 dc70bd238a7..df8f9f07c2f 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 dbfbd69b95b..909a25304f4 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 2f7acccfae8..e8f09d70cc8 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 2ecafbb08bc..9e5cea6eff5 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 04b2309fdc8..dbea70168a5 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 108e468eb66..86840f16d90 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 d19015729ec..51cd3c186fa 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 3ee6cd46c85..7129fe42876 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 f00ee960413..6e98ecce45b 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 5d107d6e60e..b19513bf1d7 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 aea525a6912..8484c160a99 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 e425d6a3f3f..8913df3b954 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 409b6b22f1c..5717e7a3907 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 631a31edeb5..1995de9dd2d 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 8aa5e098890..bd37cf80b48 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 5fa3858e857..32df30ddb5e 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 2022873d05c..61c887031bc 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 386e3a38f97..0d453901efa 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 7ced37e1535..cc28198e3ff 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 aa51b8957fc..5ee6b3cbfa6 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 cd50a9e60c3..0eaabc60cbc 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 3661e38e7b1..c2882151d3d 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 95466090891..7395e1a6aad 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 fe49951ebfd..dcd4fcd9b48 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 d52dc8f96ca..50d36e724a2 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 ff993197846..0ae49debc3a 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 baee03e6833..eab18064334 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 2dfaf8a2033..00059a2691d 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 1fd6a4b38dc..8d2b16c4501 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 5c3f525966e..f5e6b1cbd78 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 f11128cfcb6..3033479358e 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 308c995297b..07253803f5c 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 8b401329868..9b0b14cb108 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 65781f5af5c..3eb9366c850 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 61226809e52..c32c57d92f7 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 5bea708e0dd..27b8ae99753 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 5bdbda773b1..dca8a524b10 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 b7444df04cd..d514f8efcd0 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 80d58e5bace..5fbc2a86fa9 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 b0dd0eb612e..e0a6c230fd6 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 3976233819c..6aabe9ca519 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 eeb7eebfe50..7c37fa0d632 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 69bb6e1fb60..842e35392dc 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 08f6eaf8361..a8767fa9d3c 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 8b7ff5d8011..7089fc51124 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 c977fe608a7..0cd4faefd6b 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 1c0adadece0..a932632b857 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 8806f3e87fa..0f5e1640893 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 d92e68cebaa..6ae41ce4399 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 a0fa58d8175..9d4cc66c7f0 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 ac37f403860..bc9d9856e03 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 e36aa5ab395..a927cf6902e 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 2e68dd0ec4e..473113854a8 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 bd2df9236f6..dca3e73dda5 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 e2499ef5411..acc5acfbfb6 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 e21facb78f9..b4cd9686f5c 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 45092711d2e..bdb3a38be93 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 17e37f800f0..f5615de2315 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 4424b9eaade..0e3663e1603 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 c562f57252e..9b4d13a96c8 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 b5e91d61308..b85b9b60b42 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 71d5eb43c10..f53f21d7217 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 e18bf113fe7..e392240a333 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 44c6fb0dd1b..903b8f02911 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 5c2f1e09381..d287321c9f2 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 799ac45b479..74b143f6995 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 2f0df7ae857..c5de209246c 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 ee31f17bc45..44ad78b4684 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 46257a272d1..c22f1589ca1 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 bf92f30e8b3..300108530a5 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 2752125c009..c317ebd9592 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 29e6dff2068..7728d83c2b6 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 4e60806f3a7..0ae844c8da8 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 489bae4fedf..1d096c6f589 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 bc49a3c9f70..35c55374476 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 c3a52a506bc..7bf18026735 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 3cabca03360..76a0bb1d91e 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 c23a20ff084..f66efbbf709 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 2a3125157dd..f9d5f6e77d9 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 62e60b5e32d..1fced10c895 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 5a72fad8263..a3d18e5ecda 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 46df00e9c02..ce3e1e159b7 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 257093b7554..84a747e1feb 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 f6d22ff3204..45963565b06 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 697daf590ad..37cc7708d63 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 89a9bb1e1cc..8efebfd42bb 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 acf0fd421ba..056b0451bbe 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 3ef3e5114e6..d1881caa273 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 883da26d786..43fac44e48b 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 171a6f2a51e..7ad0dc69e7b 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 4692b5a3c74..91cc6669f72 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 5ebf1804302..836d41a0963 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 b593b79e7bb..7aab43b520a 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 3e81ff9a4ec..6bc3ec54286 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 d683a442027..780fd6eb619 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 adf489ad7b1..f67e9f3b3f1 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 4a92d4ef9d5..80f49d3a645 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 3c7db0095a1..dce23e2ebee 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 109fc3c0728..0262c8fd34f 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 b6e331bd854..47ff0460d7b 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 c1d888899fc..28982bc1357 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 d413caf4aaf..1ec07fe5a82 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 175a53f237d..cfefb1de993 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 8f1c3ef9bc7..580d0ef8530 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 ae38f63f034..56943951518 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 2933da92fcc..f5ab3afffc3 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 c71bc9ed923..69c70c96d2b 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 178baeca685..74493f0941f 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 d44ae9fc4e0..815016e0ade 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 7b40f7366d0..604f71ffaa6 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 a932d4a3cb4..9b9ffe4e536 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 f041e791a9b..804659d3c52 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 05666bd81aa..51960dbec4a 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 83ef520551f..6c15a82e95c 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 aa125eb1ba6..21330615a87 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 e18acfccf5f..536bd6dc1b2 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 ecbb51dfb66..fca47b4bdb1 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, From c4f6f52139f6a708ad183ec2cb619429d2c5eaaa Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 15:23:49 +1000 Subject: [PATCH 08/13] Add `warn(unreachable_pub)` to `rustc_traits`. --- compiler/rustc_traits/src/codegen.rs | 2 +- compiler/rustc_traits/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs index ada2c8e81de..11182198246 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 697c8391803..d2f979bd6d9 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; From 2e358e633d3af1dd6a4138c6c53b9d5d97f3a202 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 15:53:47 +1000 Subject: [PATCH 09/13] Add `warn(unreachable_pub)` to `rustc_trait_selection`. --- compiler/rustc_trait_selection/src/lib.rs | 1 + .../rustc_trait_selection/src/traits/coherence.rs | 2 +- .../src/traits/object_safety.rs | 10 +++++----- .../src/traits/select/_match.rs | 4 ++-- .../rustc_trait_selection/src/traits/select/mod.rs | 2 +- compiler/rustc_trait_selection/src/traits/util.rs | 14 +++++++------- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index aea47c9e987..a17c007debd 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 bf4b0482081..8ff803657f0 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 fa696dcd2f5..a3d5c530797 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 7ead65721f9..f77f83ed447 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 91fe19c20f7..bc4a3398f9b 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 0689b880f33..0fb13799e67 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, } From e4b1e2803378e1f4eb6eff0d5042e15239fae6e2 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 16:15:56 +1000 Subject: [PATCH 10/13] Add `warn(unreachable_pub)` to `rustc_transmute`. --- compiler/rustc_transmute/src/layout/tree.rs | 2 +- compiler/rustc_transmute/src/layout/tree/tests.rs | 2 +- compiler/rustc_transmute/src/lib.rs | 1 + compiler/rustc_transmute/src/maybe_transmutable/mod.rs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs index 2c67e7d4847..c3fd771b797 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 3cb47517c21..44f50a25c93 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 bdc98bcea5e..c1d0b704ab2 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 2762b4e6384..b3e1bb31e58 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>, From 3e09c450b418c7cf6d2ad54d989aa36bb20d9e80 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 16:30:18 +1000 Subject: [PATCH 11/13] Add `warn(unreachable_pub)` to `rustc_type_ir`. --- compiler/rustc_type_ir/src/fold.rs | 2 +- compiler/rustc_type_ir/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs index 8e3534b0e9e..f49aa3431b5 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 f763153a5fc..be261b348de 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; From d7caea129d3703d3021d29d873fc87ef9a97602f Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 16:32:12 +1000 Subject: [PATCH 12/13] Add `warn(unreachable_pub)` to `rustc_ty_utils`. --- compiler/rustc_ty_utils/src/errors.rs | 20 ++++++++++---------- compiler/rustc_ty_utils/src/lib.rs | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/errors.rs index 42ecaaeafa9..5497d7d0bd2 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 ad0bcbfbbc2..dc5303317a8 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; From 88b6a78d0b8b7661db8bea0d0743652bcb9a4600 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 16:36:04 +1000 Subject: [PATCH 13/13] Add `warn(unreachable_pub)` to `rustc_const_eval`. --- .../src/check_consts/check.rs | 6 +-- .../rustc_const_eval/src/check_consts/ops.rs | 40 +++++++++---------- .../rustc_const_eval/src/interpret/place.rs | 4 +- compiler/rustc_const_eval/src/lib.rs | 1 + 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 7cfb101399d..8be327a8b56 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 93fafa60557..e8f10c88408 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 ede6a51c712..220ba97f90e 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 d825a47bfdf..73dda81bd29 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;