diff --git a/Cargo.lock b/Cargo.lock
index 6ea4cd8f5aca4..23c7a5bc60f19 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2463,7 +2463,7 @@ dependencies = [
"indexmap",
"memchr",
"ruzstd 0.7.0",
- "wasmparser",
+ "wasmparser 0.215.0",
]
[[package]]
@@ -3133,7 +3133,7 @@ dependencies = [
"regex",
"serde_json",
"similar",
- "wasmparser",
+ "wasmparser 0.216.0",
]
[[package]]
@@ -5779,9 +5779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi-preview1-component-adapter-provider"
-version = "23.0.2"
+version = "24.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91d3d13afef569b9fc80cfbb807c87c16ef49bd3ac1a93285ea6a264b600d2d"
+checksum = "36e6cadfa74538edd5409b6f8c79628436529138e9618b7373bec7aae7805835"
[[package]]
name = "wasm-bindgen"
@@ -5840,16 +5840,16 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "wasm-component-ld"
-version = "0.5.6"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51449c63d1ce69f92b8465a084ed5b91f1a7eb583fa95796650a6bfcffc4f9cb"
+checksum = "13261270d3ac58ffae0219ae34f297a7e24f9ee3b13b29be579132c588a83519"
dependencies = [
"anyhow",
"clap",
"lexopt",
"tempfile",
"wasi-preview1-component-adapter-provider",
- "wasmparser",
+ "wasmparser 0.216.0",
"wat",
"wit-component",
"wit-parser",
@@ -5864,19 +5864,19 @@ dependencies = [
[[package]]
name = "wasm-encoder"
-version = "0.215.0"
+version = "0.216.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fb56df3e06b8e6b77e37d2969a50ba51281029a9aeb3855e76b7f49b6418847"
+checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88"
dependencies = [
"leb128",
- "wasmparser",
+ "wasmparser 0.216.0",
]
[[package]]
name = "wasm-metadata"
-version = "0.215.0"
+version = "0.216.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c6bb07c5576b608f7a2a9baa2294c1a3584a249965d695a9814a496cb6d232f"
+checksum = "47c8154d703a6b0e45acf6bd172fa002fc3c7058a9f7615e517220aeca27c638"
dependencies = [
"anyhow",
"indexmap",
@@ -5885,7 +5885,7 @@ dependencies = [
"serde_json",
"spdx",
"wasm-encoder",
- "wasmparser",
+ "wasmparser 0.216.0",
]
[[package]]
@@ -5893,6 +5893,15 @@ name = "wasmparser"
version = "0.215.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53fbde0881f24199b81cf49b6ff8f9c145ac8eb1b7fc439adb5c099734f7d90e"
+dependencies = [
+ "bitflags 2.6.0",
+]
+
+[[package]]
+name = "wasmparser"
+version = "0.216.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3"
dependencies = [
"ahash",
"bitflags 2.6.0",
@@ -5904,9 +5913,9 @@ dependencies = [
[[package]]
name = "wast"
-version = "215.0.0"
+version = "216.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ff1d00d893593249e60720be04a7c1f42f1c4dc3806a2869f4e66ab61eb54cb"
+checksum = "f7eb1f2eecd913fdde0dc6c3439d0f24530a98ac6db6cb3d14d92a5328554a08"
dependencies = [
"bumpalo",
"leb128",
@@ -5917,9 +5926,9 @@ dependencies = [
[[package]]
name = "wat"
-version = "1.215.0"
+version = "1.216.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "670bf4d9c8cf76ae242d70ded47c546525b6dafaa6871f9bcb065344bf2b4e3d"
+checksum = "ac0409090fb5154f95fb5ba3235675fd9e579e731524d63b6a2f653e1280c82a"
dependencies = [
"wast",
]
@@ -6206,9 +6215,9 @@ dependencies = [
[[package]]
name = "wit-component"
-version = "0.215.0"
+version = "0.216.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f725e3885fc5890648be5c5cbc1353b755dc932aa5f1aa7de968b912a3280743"
+checksum = "7e2ca3ece38ea2447a9069b43074ba73d96dde1944cba276c54e41371745f9dc"
dependencies = [
"anyhow",
"bitflags 2.6.0",
@@ -6219,15 +6228,15 @@ dependencies = [
"serde_json",
"wasm-encoder",
"wasm-metadata",
- "wasmparser",
+ "wasmparser 0.216.0",
"wit-parser",
]
[[package]]
name = "wit-parser"
-version = "0.215.0"
+version = "0.216.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "935a97eaffd57c3b413aa510f8f0b550a4a9fe7d59e79cd8b89a83dcb860321f"
+checksum = "a4d108165c1167a4ccc8a803dcf5c28e0a51d6739fd228cc7adce768632c764c"
dependencies = [
"anyhow",
"id-arena",
@@ -6238,7 +6247,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-xid",
- "wasmparser",
+ "wasmparser 0.216.0",
]
[[package]]
diff --git a/RELEASES.md b/RELEASES.md
index 5e4827be4ecfd..6aba476103e7f 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -1,3 +1,117 @@
+Version 1.81.0 (2024-09-05)
+==========================
+
+
+
+Language
+--------
+
+- [Abort on uncaught panics in `extern "C"` functions.](https://github.com/rust-lang/rust/pull/116088/)
+- [Fix ambiguous cases of multiple `&` in elided self lifetimes.](https://github.com/rust-lang/rust/pull/117967/)
+- [Stabilize `#[expect]` for lints (RFC 2383),](https://github.com/rust-lang/rust/pull/120924/) like `#[allow]` with a warning if the lint is _not_ fulfilled.
+- [Change method resolution to constrain hidden types instead of rejecting method candidates.](https://github.com/rust-lang/rust/pull/123962/)
+- [Bump `elided_lifetimes_in_associated_constant` to deny.](https://github.com/rust-lang/rust/pull/124211/)
+- [`offset_from`: always allow pointers to point to the same address.](https://github.com/rust-lang/rust/pull/124921/)
+- [Allow constraining opaque types during subtyping in the trait system.](https://github.com/rust-lang/rust/pull/125447/)
+- [Allow constraining opaque types during various unsizing casts.](https://github.com/rust-lang/rust/pull/125610/)
+- [Deny keyword lifetimes pre-expansion.](https://github.com/rust-lang/rust/pull/126762/)
+
+
+
+Compiler
+--------
+
+- [Make casts of pointers to trait objects stricter.](https://github.com/rust-lang/rust/pull/120248/)
+- [Check alias args for well-formedness even if they have escaping bound vars.](https://github.com/rust-lang/rust/pull/123737/)
+- [Deprecate no-op codegen option `-Cinline-threshold=...`.](https://github.com/rust-lang/rust/pull/124712/)
+- [Re-implement a type-size based limit.](https://github.com/rust-lang/rust/pull/125507/)
+- [Properly account for alignment in `transmute` size checks.](https://github.com/rust-lang/rust/pull/125740/)
+- [Remove the `box_pointers` lint.](https://github.com/rust-lang/rust/pull/126018/)
+- [Ensure the interpreter checks bool/char for validity when they are used in a cast.](https://github.com/rust-lang/rust/pull/126265/)
+- [Improve coverage instrumentation for functions containing nested items.](https://github.com/rust-lang/rust/pull/127199/)
+- Target changes:
+ - [Add Tier 3 `no_std` Xtensa targets:](https://github.com/rust-lang/rust/pull/125141/) `xtensa-esp32-none-elf`, `xtensa-esp32s2-none-elf`, `xtensa-esp32s3-none-elf`
+ - [Add Tier 3 `std` Xtensa targets:](https://github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf`
+ - [Add Tier 3 i686 Redox OS target:](https://github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox`
+ - [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://github.com/rust-lang/rust/pull/126039/)
+ - [Promote `wasm32-wasip2` to Tier 2.](https://github.com/rust-lang/rust/pull/126967/)
+ - [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/126298/)
+ - [Enable full tools and profiler for LoongArch Linux targets.](https://github.com/rust-lang/rust/pull/127078/)
+ - [Unconditionally warn on usage of `wasm32-wasi`.](https://github.com/rust-lang/rust/pull/126662/) (see compatibility note below)
+ - Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
+
+
+
+Libraries
+---------
+
+- [Split core's `PanicInfo` and std's `PanicInfo`.](https://github.com/rust-lang/rust/pull/115974/) (see compatibility note below)
+- [Generalize `{Rc,Arc}::make_mut()` to unsized types.](https://github.com/rust-lang/rust/pull/116113/)
+- [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://github.com/Voultapher/sort-research-rs) for more details.
+- [Document behavior of `create_dir_all` with respect to empty paths.](https://github.com/rust-lang/rust/pull/125112/)
+- [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://github.com/rust-lang/rust/pull/127397/)
+
+
+
+Stabilized APIs
+---------------
+
+- [`core::error`](https://doc.rust-lang.org/stable/core/error/index.html)
+- [`hint::assert_unchecked`](https://doc.rust-lang.org/stable/core/hint/fn.assert_unchecked.html)
+- [`fs::exists`](https://doc.rust-lang.org/stable/std/fs/fn.exists.html)
+- [`AtomicBool::fetch_not`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.fetch_not)
+- [`Duration::abs_diff`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.abs_diff)
+- [`IoSlice::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance)
+- [`IoSlice::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance_slices)
+- [`IoSliceMut::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance)
+- [`IoSliceMut::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance_slices)
+- [`PanicHookInfo`](https://doc.rust-lang.org/stable/std/panic/struct.PanicHookInfo.html)
+- [`PanicInfo::message`](https://doc.rust-lang.org/stable/core/panic/struct.PanicInfo.html#method.message)
+- [`PanicMessage`](https://doc.rust-lang.org/stable/core/panic/struct.PanicMessage.html)
+
+These APIs are now stable in const contexts:
+
+- [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/char/fn.from_u32_unchecked.html) (function)
+- [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.from_u32_unchecked) (method)
+- [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes)
+- [`CStr::from_ptr`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.from_ptr)
+
+
+
+Cargo
+-----
+
+- [Generated `.cargo_vcs_info.json` is always included, even when `--allow-dirty` is passed.](https://github.com/rust-lang/cargo/pull/13960/)
+- [Disallow `package.license-file` and `package.readme` pointing to non-existent files during packaging.](https://github.com/rust-lang/cargo/pull/13921/)
+- [Disallow passing `--release`/`--debug` flag along with the `--profile` flag.](https://github.com/rust-lang/cargo/pull/13971/)
+- [Remove `lib.plugin` key support in `Cargo.toml`. Rust plugin support has been deprecated for four years and was removed in 1.75.0.](https://github.com/rust-lang/cargo/pull/13902/)
+
+
+
+Compatibility Notes
+-------------------
+
+* Usage of the `wasm32-wasi` target will now issue a compiler warning and request users switch to the `wasm32-wasip1` target instead. Both targets are the same, `wasm32-wasi` is only being renamed, and this [change to the WASI target](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) is being done to enable removing `wasm32-wasi` in January 2025.
+
+* We have renamed `std::panic::PanicInfo` to `std::panic::PanicHookInfo`. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.
+
+ `core::panic::PanicInfo` will remain unchanged, however, as this is now a *different type*.
+
+ The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.
+
+* The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
+
+
+
+Internal Changes
+----------------
+
+These changes do not affect any public interfaces of Rust, but they represent
+significant improvements to the performance or internals of rustc and related
+tools.
+
+- [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/)
+
Version 1.80.0 (2024-07-25)
==========================
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
index e78039bafd8dd..3ab4cd0a0f53c 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -41,7 +41,7 @@ tempfile = "3.2"
thin-vec = "0.2.12"
thorin-dwp = "0.7"
tracing = "0.1"
-wasm-encoder = "0.215.0"
+wasm-encoder = "0.216.0"
# tidy-alphabetical-end
[target.'cfg(unix)'.dependencies]
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl
index db788b6b15199..8a6dfb892490a 100644
--- a/compiler/rustc_const_eval/messages.ftl
+++ b/compiler/rustc_const_eval/messages.ftl
@@ -415,8 +415,8 @@ const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
const_eval_unstable_in_stable =
const-stable function cannot use `#[feature({$gate})]`
- .unstable_sugg = if it is not part of the public API, make this function unstably const
- .bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
+ .unstable_sugg = if the function is not (yet) meant to be stable, make this function unstably const
+ .bypass_sugg = otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
const_eval_unterminated_c_string =
reading a null-terminated string starting at {$pointer} with no null found before end of allocation
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs
index 6a086a3a7e5a0..d2dbb0e5f2963 100644
--- a/compiler/rustc_const_eval/src/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/check_consts/check.rs
@@ -46,7 +46,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
/// Returns `true` if `local` is `NeedsDrop` at the given `Location`.
///
/// Only updates the cursor if absolutely necessary
- pub fn needs_drop(
+ fn needs_drop(
&mut self,
ccx: &'mir ConstCx<'mir, 'tcx>,
local: Local,
@@ -76,7 +76,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
/// Returns `true` if `local` is `NeedsNonConstDrop` at the given `Location`.
///
/// Only updates the cursor if absolutely necessary
- pub fn needs_non_const_drop(
+ pub(crate) fn needs_non_const_drop(
&mut self,
ccx: &'mir ConstCx<'mir, 'tcx>,
local: Local,
@@ -106,7 +106,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
/// Returns `true` if `local` is `HasMutInterior` at the given `Location`.
///
/// Only updates the cursor if absolutely necessary.
- pub fn has_mut_interior(
+ fn has_mut_interior(
&mut self,
ccx: &'mir ConstCx<'mir, 'tcx>,
local: Local,
diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs
index 93fafa6055773..e8f10c88408ba 100644
--- a/compiler/rustc_const_eval/src/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/check_consts/ops.rs
@@ -57,7 +57,7 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug {
/// A function call where the callee is a pointer.
#[derive(Debug)]
-pub struct FnCallIndirect;
+pub(crate) struct FnCallIndirect;
impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::UnallowedFnPointerCall { span, kind: ccx.const_kind() })
@@ -66,7 +66,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallIndirect {
/// A function call where the callee is not marked as `const`.
#[derive(Debug, Clone, Copy)]
-pub struct FnCallNonConst<'tcx> {
+pub(crate) struct FnCallNonConst<'tcx> {
pub caller: LocalDefId,
pub callee: DefId,
pub args: GenericArgsRef<'tcx>,
@@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
///
/// Contains the name of the feature that would allow the use of this function.
#[derive(Debug)]
-pub struct FnCallUnstable(pub DefId, pub Option);
+pub(crate) struct FnCallUnstable(pub DefId, pub Option);
impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
@@ -324,7 +324,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
}
#[derive(Debug)]
-pub struct Coroutine(pub hir::CoroutineKind);
+pub(crate) struct Coroutine(pub hir::CoroutineKind);
impl<'tcx> NonConstOp<'tcx> for Coroutine {
fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status {
if let hir::CoroutineKind::Desugared(
@@ -356,7 +356,7 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine {
}
#[derive(Debug)]
-pub struct HeapAllocation;
+pub(crate) struct HeapAllocation;
impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::UnallowedHeapAllocations {
@@ -368,7 +368,7 @@ impl<'tcx> NonConstOp<'tcx> for HeapAllocation {
}
#[derive(Debug)]
-pub struct InlineAsm;
+pub(crate) struct InlineAsm;
impl<'tcx> NonConstOp<'tcx> for InlineAsm {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::UnallowedInlineAsm { span, kind: ccx.const_kind() })
@@ -376,7 +376,7 @@ impl<'tcx> NonConstOp<'tcx> for InlineAsm {
}
#[derive(Debug)]
-pub struct LiveDrop<'tcx> {
+pub(crate) struct LiveDrop<'tcx> {
pub dropped_at: Option,
pub dropped_ty: Ty<'tcx>,
}
@@ -394,7 +394,7 @@ impl<'tcx> NonConstOp<'tcx> for LiveDrop<'tcx> {
#[derive(Debug)]
/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow never escapes to
/// the final value of the constant.
-pub struct TransientCellBorrow;
+pub(crate) struct TransientCellBorrow;
impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status {
Status::Unstable(sym::const_refs_to_cell)
@@ -410,7 +410,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
/// A borrow of a type that contains an `UnsafeCell` somewhere. The borrow might escape to
/// the final value of the constant, and thus we cannot allow this (for now). We may allow
/// it in the future for static items.
-pub struct CellBorrow;
+pub(crate) struct CellBorrow;
impl<'tcx> NonConstOp<'tcx> for CellBorrow {
fn importance(&self) -> DiagImportance {
// Most likely the code will try to do mutation with these borrows, which
@@ -431,7 +431,7 @@ impl<'tcx> NonConstOp<'tcx> for CellBorrow {
/// This op is for `&mut` borrows in the trailing expression of a constant
/// which uses the "enclosing scopes rule" to leak its locals into anonymous
/// static or const items.
-pub struct MutBorrow(pub hir::BorrowKind);
+pub(crate) struct MutBorrow(pub hir::BorrowKind);
impl<'tcx> NonConstOp<'tcx> for MutBorrow {
fn status_in_item(&self, _ccx: &ConstCx<'_, 'tcx>) -> Status {
@@ -461,7 +461,7 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
}
#[derive(Debug)]
-pub struct TransientMutBorrow(pub hir::BorrowKind);
+pub(crate) struct TransientMutBorrow(pub hir::BorrowKind);
impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow {
fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status {
@@ -484,7 +484,7 @@ impl<'tcx> NonConstOp<'tcx> for TransientMutBorrow {
}
#[derive(Debug)]
-pub struct MutDeref;
+pub(crate) struct MutDeref;
impl<'tcx> NonConstOp<'tcx> for MutDeref {
fn status_in_item(&self, _: &ConstCx<'_, 'tcx>) -> Status {
Status::Unstable(sym::const_mut_refs)
@@ -505,7 +505,7 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref {
/// A call to a `panic()` lang item where the first argument is _not_ a `&str`.
#[derive(Debug)]
-pub struct PanicNonStr;
+pub(crate) struct PanicNonStr;
impl<'tcx> NonConstOp<'tcx> for PanicNonStr {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::PanicNonStrErr { span })
@@ -516,7 +516,7 @@ impl<'tcx> NonConstOp<'tcx> for PanicNonStr {
/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
/// allocation base addresses that are not known at compile-time.
#[derive(Debug)]
-pub struct RawPtrComparison;
+pub(crate) struct RawPtrComparison;
impl<'tcx> NonConstOp<'tcx> for RawPtrComparison {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
// FIXME(const_trait_impl): revert to span_bug?
@@ -525,7 +525,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrComparison {
}
#[derive(Debug)]
-pub struct RawMutPtrDeref;
+pub(crate) struct RawMutPtrDeref;
impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {
Status::Unstable(sym::const_mut_refs)
@@ -546,7 +546,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref {
/// Not currently intended to ever be allowed, even behind a feature gate: operation depends on
/// allocation base addresses that are not known at compile-time.
#[derive(Debug)]
-pub struct RawPtrToIntCast;
+pub(crate) struct RawPtrToIntCast;
impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::RawPtrToIntErr { span })
@@ -555,7 +555,7 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast {
/// An access to a (non-thread-local) `static`.
#[derive(Debug)]
-pub struct StaticAccess;
+pub(crate) struct StaticAccess;
impl<'tcx> NonConstOp<'tcx> for StaticAccess {
fn status_in_item(&self, ccx: &ConstCx<'_, 'tcx>) -> Status {
if let hir::ConstContext::Static(_) = ccx.const_kind() {
@@ -582,7 +582,7 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
/// An access to a thread-local `static`.
#[derive(Debug)]
-pub struct ThreadLocalAccess;
+pub(crate) struct ThreadLocalAccess;
impl<'tcx> NonConstOp<'tcx> for ThreadLocalAccess {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
ccx.dcx().create_err(errors::ThreadLocalAccessErr { span })
@@ -590,11 +590,11 @@ impl<'tcx> NonConstOp<'tcx> for ThreadLocalAccess {
}
/// Types that cannot appear in the signature or locals of a `const fn`.
-pub mod mut_ref {
+pub(crate) mod mut_ref {
use super::*;
#[derive(Debug)]
- pub struct MutRef(pub mir::LocalKind);
+ pub(crate) struct MutRef(pub mir::LocalKind);
impl<'tcx> NonConstOp<'tcx> for MutRef {
fn status_in_item(&self, _ccx: &ConstCx<'_, 'tcx>) -> Status {
Status::Unstable(sym::const_mut_refs)
diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs
index 88453245b8444..6cfd7be48e624 100644
--- a/compiler/rustc_const_eval/src/interpret/machine.rs
+++ b/compiler/rustc_const_eval/src/interpret/machine.rs
@@ -362,17 +362,7 @@ pub trait Machine<'tcx>: Sized {
ecx: &InterpCx<'tcx, Self>,
id: AllocId,
alloc: &'b Allocation,
- ) -> InterpResult<'tcx, Cow<'b, Allocation>>
- {
- // The default implementation does a copy; CTFE machines have a more efficient implementation
- // based on their particular choice for `Provenance`, `AllocExtra`, and `Bytes`.
- let kind = Self::GLOBAL_KIND
- .expect("if GLOBAL_KIND is None, adjust_global_allocation must be overwritten");
- let alloc = alloc.adjust_from_tcx(&ecx.tcx, |ptr| ecx.global_root_pointer(ptr))?;
- let extra =
- Self::init_alloc_extra(ecx, id, MemoryKind::Machine(kind), alloc.size(), alloc.align)?;
- Ok(Cow::Owned(alloc.with_extra(extra)))
- }
+ ) -> InterpResult<'tcx, Cow<'b, Allocation>>;
/// Initialize the extra state of an allocation.
///
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs
index 2afdd02c88035..31f59b962a5fc 100644
--- a/compiler/rustc_const_eval/src/interpret/place.rs
+++ b/compiler/rustc_const_eval/src/interpret/place.rs
@@ -61,13 +61,13 @@ pub(super) struct MemPlace {
impl MemPlace {
/// Adjust the provenance of the main pointer (metadata is unaffected).
- pub fn map_provenance(self, f: impl FnOnce(Prov) -> Prov) -> Self {
+ fn map_provenance(self, f: impl FnOnce(Prov) -> Prov) -> Self {
MemPlace { ptr: self.ptr.map_provenance(|p| p.map(f)), ..self }
}
/// Turn a mplace into a (thin or wide) pointer, as a reference, pointing to the same space.
#[inline]
- pub fn to_ref(self, cx: &impl HasDataLayout) -> Immediate {
+ fn to_ref(self, cx: &impl HasDataLayout) -> Immediate {
Immediate::new_pointer_with_meta(self.ptr, self.meta, cx)
}
diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs
index d825a47bfdf5d..73dda81bd298b 100644
--- a/compiler/rustc_const_eval/src/lib.rs
+++ b/compiler/rustc_const_eval/src/lib.rs
@@ -14,6 +14,7 @@
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(yeet_expr)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod check_consts;
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index 3e101c0c6354d..5fb8af576ae93 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -358,10 +358,11 @@ impl Allocation {
pub fn adjust_from_tcx(
&self,
cx: &impl HasDataLayout,
+ mut alloc_bytes: impl FnMut(&[u8], Align) -> Result,
mut adjust_ptr: impl FnMut(Pointer) -> Result, Err>,
) -> Result, Err> {
// Copy the data.
- let mut bytes = Bytes::from_bytes(Cow::Borrowed(&*self.bytes), self.align);
+ let mut bytes = alloc_bytes(&*self.bytes, self.align)?;
// Adjust provenance of pointers stored in this allocation.
let mut new_provenance = Vec::with_capacity(self.provenance.ptrs().len());
let ptr_size = cx.data_layout().pointer_size.bytes_usize();
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 4d58590ca3b0e..ba4c300ea61af 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -544,9 +544,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
let is_stable =
self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable());
let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none();
- let is_reachable = self.effective_visibilities.is_reachable(def_id);
- if is_const && is_stable && missing_const_stability_attribute && is_reachable {
+ if is_const && is_stable && missing_const_stability_attribute {
let descr = self.tcx.def_descr(def_id.to_def_id());
self.tcx.dcx().emit_err(errors::MissingConstStabAttr { span, descr });
}
diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs
index a4e4f50e8f2d4..45057a3530c3e 100644
--- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs
+++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs
@@ -26,11 +26,11 @@ use crate::cfi::typeid::itanium_cxx_abi::transform::{TransformTy, TransformTyOpt
use crate::cfi::typeid::TypeIdOptions;
/// Options for encode_ty.
-pub type EncodeTyOptions = TypeIdOptions;
+pub(crate) type EncodeTyOptions = TypeIdOptions;
/// Substitution dictionary key.
#[derive(Eq, Hash, PartialEq)]
-pub enum DictKey<'tcx> {
+pub(crate) enum DictKey<'tcx> {
Ty(Ty<'tcx>, TyQ),
Region(Region<'tcx>),
Const(Const<'tcx>),
@@ -39,7 +39,7 @@ pub enum DictKey<'tcx> {
/// Type and extended type qualifiers.
#[derive(Eq, Hash, PartialEq)]
-pub enum TyQ {
+pub(crate) enum TyQ {
None,
Const,
Mut,
diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
index 2f43199796cc6..8db0d3585378f 100644
--- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
+++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
@@ -23,16 +23,16 @@ use crate::cfi::typeid::itanium_cxx_abi::encode::EncodeTyOptions;
use crate::cfi::typeid::TypeIdOptions;
/// Options for transform_ty.
-pub type TransformTyOptions = TypeIdOptions;
+pub(crate) type TransformTyOptions = TypeIdOptions;
-pub struct TransformTy<'tcx> {
+pub(crate) struct TransformTy<'tcx> {
tcx: TyCtxt<'tcx>,
options: TransformTyOptions,
parents: Vec>,
}
impl<'tcx> TransformTy<'tcx> {
- pub fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self {
+ pub(crate) fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self {
TransformTy { tcx, options, parents: Vec::new() }
}
}
diff --git a/compiler/rustc_sanitizers/src/lib.rs b/compiler/rustc_sanitizers/src/lib.rs
index e4792563e71ea..55be931bcd6d4 100644
--- a/compiler/rustc_sanitizers/src/lib.rs
+++ b/compiler/rustc_sanitizers/src/lib.rs
@@ -5,6 +5,7 @@
// tidy-alphabetical-start
#![feature(let_chains)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod cfi;
diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs
index f0e1630c65009..b7977a848ce00 100644
--- a/compiler/rustc_serialize/src/lib.rs
+++ b/compiler/rustc_serialize/src/lib.rs
@@ -16,6 +16,7 @@
#![feature(never_type)]
#![feature(ptr_sub_ptr)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub use self::serialize::{Decodable, Decoder, Encodable, Encoder};
diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs
index d93b3eac08040..7e059a88c2790 100644
--- a/compiler/rustc_session/src/lib.rs
+++ b/compiler/rustc_session/src/lib.rs
@@ -5,6 +5,7 @@
#![feature(map_many_mut)]
#![feature(option_get_or_insert_default)]
#![feature(rustc_attrs)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod errors;
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 4492ad09357b6..ffe88bb22aa62 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -358,93 +358,97 @@ 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(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`";
}
mod parse {
diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_smir/src/lib.rs
index 9f88887530614..2215e2f01ade0 100644
--- a/compiler/rustc_smir/src/lib.rs
+++ b/compiler/rustc_smir/src/lib.rs
@@ -15,6 +15,7 @@
)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod rustc_internal;
diff --git a/compiler/rustc_smir/src/rustc_smir/alloc.rs b/compiler/rustc_smir/src/rustc_smir/alloc.rs
index 677b4c7a9c0e3..11fbc005e37da 100644
--- a/compiler/rustc_smir/src/rustc_smir/alloc.rs
+++ b/compiler/rustc_smir/src/rustc_smir/alloc.rs
@@ -20,7 +20,7 @@ fn new_empty_allocation(align: rustc_target::abi::Align) -> Allocation {
// because we need to get `Ty` of the const we are trying to create, to do that
// we need to have access to `ConstantKind` but we can't access that inside Stable impl.
#[allow(rustc::usage_of_qualified_ty)]
-pub fn new_allocation<'tcx>(
+pub(crate) fn new_allocation<'tcx>(
ty: rustc_middle::ty::Ty<'tcx>,
const_value: ConstValue<'tcx>,
tables: &mut Tables<'tcx>,
@@ -30,7 +30,7 @@ pub fn new_allocation<'tcx>(
}
#[allow(rustc::usage_of_qualified_ty)]
-pub fn try_new_allocation<'tcx>(
+pub(crate) fn try_new_allocation<'tcx>(
ty: rustc_middle::ty::Ty<'tcx>,
const_value: ConstValue<'tcx>,
tables: &mut Tables<'tcx>,
diff --git a/compiler/rustc_smir/src/rustc_smir/builder.rs b/compiler/rustc_smir/src/rustc_smir/builder.rs
index 883ab7c18b485..cd91fc26c1018 100644
--- a/compiler/rustc_smir/src/rustc_smir/builder.rs
+++ b/compiler/rustc_smir/src/rustc_smir/builder.rs
@@ -12,13 +12,13 @@ use rustc_middle::ty::{self, TyCtxt};
use crate::rustc_smir::{Stable, Tables};
/// Builds a monomorphic body for a given instance.
-pub struct BodyBuilder<'tcx> {
+pub(crate) struct BodyBuilder<'tcx> {
tcx: TyCtxt<'tcx>,
instance: ty::Instance<'tcx>,
}
impl<'tcx> BodyBuilder<'tcx> {
- pub fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self {
+ pub(crate) fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self {
let instance = match instance.def {
// To get the fallback body of an intrinsic, we need to convert it to an item.
ty::InstanceKind::Intrinsic(def_id) => ty::Instance::new(def_id, instance.args),
@@ -30,7 +30,7 @@ impl<'tcx> BodyBuilder<'tcx> {
/// Build a stable monomorphic body for a given instance based on the MIR body.
///
/// All constants are also evaluated.
- pub fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body {
+ pub(crate) fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body {
let body = tables.tcx.instance_mir(self.instance.def).clone();
let mono_body = if !self.instance.args.is_empty()
// Without the `generic_const_exprs` feature gate, anon consts in signatures do not
diff --git a/compiler/rustc_smir/src/rustc_smir/context.rs b/compiler/rustc_smir/src/rustc_smir/context.rs
index f9663f2dd30d9..a4ede374a19dc 100644
--- a/compiler/rustc_smir/src/rustc_smir/context.rs
+++ b/compiler/rustc_smir/src/rustc_smir/context.rs
@@ -784,7 +784,7 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
}
}
-pub struct TablesWrapper<'tcx>(pub RefCell>);
+pub(crate) struct TablesWrapper<'tcx>(pub RefCell>);
/// Implement error handling for extracting function ABI information.
impl<'tcx> FnAbiOfHelpers<'tcx> for Tables<'tcx> {
diff --git a/compiler/rustc_smir/src/rustc_smir/convert/mod.rs b/compiler/rustc_smir/src/rustc_smir/convert/mod.rs
index 50687935473a7..c9795fca3993a 100644
--- a/compiler/rustc_smir/src/rustc_smir/convert/mod.rs
+++ b/compiler/rustc_smir/src/rustc_smir/convert/mod.rs
@@ -9,7 +9,7 @@ mod error;
mod mir;
mod ty;
-pub use ty::mir_const_from_ty_const;
+pub(crate) use ty::mir_const_from_ty_const;
impl<'tcx> Stable<'tcx> for rustc_hir::Safety {
type T = stable_mir::mir::Safety;
diff --git a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs
index 9afd732486c28..efbb0f244fc8f 100644
--- a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs
+++ b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs
@@ -411,7 +411,7 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> {
}
}
-pub fn mir_const_from_ty_const<'tcx>(
+pub(crate) fn mir_const_from_ty_const<'tcx>(
tables: &mut Tables<'tcx>,
ty_const: ty::Const<'tcx>,
ty: Ty<'tcx>,
diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs
index ba7e0cec5bd80..28ce883daee9a 100644
--- a/compiler/rustc_span/src/analyze_source_file.rs
+++ b/compiler/rustc_span/src/analyze_source_file.rs
@@ -8,7 +8,7 @@ mod tests;
///
/// This function will use an SSE2 enhanced implementation if hardware support
/// is detected at runtime.
-pub fn analyze_source_file(src: &str) -> (Vec, Vec) {
+pub(crate) fn analyze_source_file(src: &str) -> (Vec, Vec) {
let mut lines = vec![RelativeBytePos::from_u32(0)];
let mut multi_byte_chars = vec![];
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 7b020f11cdda0..45dca3af6c07d 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -30,6 +30,7 @@
#![feature(round_char_boundary)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
// The code produced by the `Encodable`/`Decodable` derive macros refer to
diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs
index 8988becb17126..3047abfbb5cb0 100644
--- a/compiler/rustc_span/src/span_encoding.rs
+++ b/compiler/rustc_span/src/span_encoding.rs
@@ -424,7 +424,7 @@ impl Span {
}
#[derive(Default)]
-pub struct SpanInterner {
+pub(crate) struct SpanInterner {
spans: FxIndexSet,
}
diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs
index dea4eb08c7615..0c97cda81c8af 100644
--- a/compiler/rustc_symbol_mangling/src/lib.rs
+++ b/compiler/rustc_symbol_mangling/src/lib.rs
@@ -93,6 +93,7 @@
#![doc(rust_logo)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
use rustc_hir::def::DefKind;
diff --git a/compiler/rustc_target/src/abi/call/aarch64.rs b/compiler/rustc_target/src/abi/call/aarch64.rs
index 04020d13f22f9..55b65fb1caaaf 100644
--- a/compiler/rustc_target/src/abi/call/aarch64.rs
+++ b/compiler/rustc_target/src/abi/call/aarch64.rs
@@ -6,7 +6,7 @@ use crate::abi::{HasDataLayout, TyAbiInterface};
///
/// Corresponds to Clang's `AArch64ABIInfo::ABIKind`.
#[derive(Copy, Clone, PartialEq)]
-pub enum AbiKind {
+pub(crate) enum AbiKind {
AAPCS,
DarwinPCS,
Win64,
@@ -109,7 +109,7 @@ where
arg.make_indirect();
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, kind: AbiKind)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
diff --git a/compiler/rustc_target/src/abi/call/amdgpu.rs b/compiler/rustc_target/src/abi/call/amdgpu.rs
index e30dead63cbf8..3007a729a8b8a 100644
--- a/compiler/rustc_target/src/abi/call/amdgpu.rs
+++ b/compiler/rustc_target/src/abi/call/amdgpu.rs
@@ -17,7 +17,7 @@ where
arg.extend_integer_width_to(32);
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
diff --git a/compiler/rustc_target/src/abi/call/arm.rs b/compiler/rustc_target/src/abi/call/arm.rs
index 9371e1b395865..bd6f781fb8120 100644
--- a/compiler/rustc_target/src/abi/call/arm.rs
+++ b/compiler/rustc_target/src/abi/call/arm.rs
@@ -81,7 +81,7 @@ where
arg.cast_to(Uniform::consecutive(if align <= 4 { Reg::i32() } else { Reg::i64() }, total));
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/avr.rs b/compiler/rustc_target/src/abi/call/avr.rs
index b01dac8c70d7e..dfc991e09543a 100644
--- a/compiler/rustc_target/src/abi/call/avr.rs
+++ b/compiler/rustc_target/src/abi/call/avr.rs
@@ -44,7 +44,7 @@ fn classify_arg_ty(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fty: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fty: &mut FnAbi<'_, Ty>) {
if !fty.ret.is_ignore() {
classify_ret_ty(&mut fty.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/bpf.rs b/compiler/rustc_target/src/abi/call/bpf.rs
index 780e7df438373..f19772ac70918 100644
--- a/compiler/rustc_target/src/abi/call/bpf.rs
+++ b/compiler/rustc_target/src/abi/call/bpf.rs
@@ -17,7 +17,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/csky.rs b/compiler/rustc_target/src/abi/call/csky.rs
index 7951f28beeaff..b1c1ae814a7ed 100644
--- a/compiler/rustc_target/src/abi/call/csky.rs
+++ b/compiler/rustc_target/src/abi/call/csky.rs
@@ -47,7 +47,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/hexagon.rs b/compiler/rustc_target/src/abi/call/hexagon.rs
index 80a442048d53c..0a0688880c019 100644
--- a/compiler/rustc_target/src/abi/call/hexagon.rs
+++ b/compiler/rustc_target/src/abi/call/hexagon.rs
@@ -16,7 +16,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/loongarch.rs b/compiler/rustc_target/src/abi/call/loongarch.rs
index 893818af77c30..4a21935623b92 100644
--- a/compiler/rustc_target/src/abi/call/loongarch.rs
+++ b/compiler/rustc_target/src/abi/call/loongarch.rs
@@ -325,7 +325,7 @@ fn extend_integer_width(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
arg.extend_integer_width_to(xlen);
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/m68k.rs b/compiler/rustc_target/src/abi/call/m68k.rs
index 06697bdd83ee7..b6bd68b66fcc4 100644
--- a/compiler/rustc_target/src/abi/call/m68k.rs
+++ b/compiler/rustc_target/src/abi/call/m68k.rs
@@ -20,7 +20,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/mips.rs b/compiler/rustc_target/src/abi/call/mips.rs
index 0e5a7f37a094c..37980a91c7601 100644
--- a/compiler/rustc_target/src/abi/call/mips.rs
+++ b/compiler/rustc_target/src/abi/call/mips.rs
@@ -35,7 +35,7 @@ where
*offset = offset.align_to(align) + size.align_to(align);
}
-pub fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
+pub(crate) fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
where
C: HasDataLayout,
{
diff --git a/compiler/rustc_target/src/abi/call/mips64.rs b/compiler/rustc_target/src/abi/call/mips64.rs
index 5b52ebbdedd1a..2c3258c8d42d4 100644
--- a/compiler/rustc_target/src/abi/call/mips64.rs
+++ b/compiler/rustc_target/src/abi/call/mips64.rs
@@ -149,7 +149,7 @@ where
});
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
diff --git a/compiler/rustc_target/src/abi/call/msp430.rs b/compiler/rustc_target/src/abi/call/msp430.rs
index 33ef47be00993..4f613aa6c1549 100644
--- a/compiler/rustc_target/src/abi/call/msp430.rs
+++ b/compiler/rustc_target/src/abi/call/msp430.rs
@@ -25,7 +25,7 @@ fn classify_arg(arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/nvptx64.rs b/compiler/rustc_target/src/abi/call/nvptx64.rs
index 27d197af7925b..2e8b16d3a938e 100644
--- a/compiler/rustc_target/src/abi/call/nvptx64.rs
+++ b/compiler/rustc_target/src/abi/call/nvptx64.rs
@@ -71,7 +71,7 @@ where
}
}
-pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
@@ -84,7 +84,7 @@ pub fn compute_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
}
}
-pub fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_ptx_kernel_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
diff --git a/compiler/rustc_target/src/abi/call/powerpc.rs b/compiler/rustc_target/src/abi/call/powerpc.rs
index 8f67f57cd2b3e..f3b05c4817301 100644
--- a/compiler/rustc_target/src/abi/call/powerpc.rs
+++ b/compiler/rustc_target/src/abi/call/powerpc.rs
@@ -27,7 +27,7 @@ fn classify_arg(cx: &impl HasTargetSpec, arg: &mut ArgAbi<'_, Ty>) {
}
}
-pub fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs
index 749eea0ef6350..b9767bf906bd0 100644
--- a/compiler/rustc_target/src/abi/call/powerpc64.rs
+++ b/compiler/rustc_target/src/abi/call/powerpc64.rs
@@ -86,7 +86,7 @@ where
};
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/riscv.rs b/compiler/rustc_target/src/abi/call/riscv.rs
index 84f13f8cc5da9..be6bc701b497e 100644
--- a/compiler/rustc_target/src/abi/call/riscv.rs
+++ b/compiler/rustc_target/src/abi/call/riscv.rs
@@ -331,7 +331,7 @@ fn extend_integer_width(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
arg.extend_integer_width_to(xlen);
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/s390x.rs b/compiler/rustc_target/src/abi/call/s390x.rs
index 901ce139c7be1..502e733126777 100644
--- a/compiler/rustc_target/src/abi/call/s390x.rs
+++ b/compiler/rustc_target/src/abi/call/s390x.rs
@@ -54,7 +54,7 @@ where
}
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/sparc.rs b/compiler/rustc_target/src/abi/call/sparc.rs
index 0e5a7f37a094c..37980a91c7601 100644
--- a/compiler/rustc_target/src/abi/call/sparc.rs
+++ b/compiler/rustc_target/src/abi/call/sparc.rs
@@ -35,7 +35,7 @@ where
*offset = offset.align_to(align) + size.align_to(align);
}
-pub fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
+pub(crate) fn compute_abi_info(cx: &C, fn_abi: &mut FnAbi<'_, Ty>)
where
C: HasDataLayout,
{
diff --git a/compiler/rustc_target/src/abi/call/sparc64.rs b/compiler/rustc_target/src/abi/call/sparc64.rs
index 311691d8efb9b..2954d9642df95 100644
--- a/compiler/rustc_target/src/abi/call/sparc64.rs
+++ b/compiler/rustc_target/src/abi/call/sparc64.rs
@@ -7,7 +7,7 @@ use crate::abi::{self, HasDataLayout, Scalar, Size, TyAbiInterface, TyAndLayout}
use crate::spec::HasTargetSpec;
#[derive(Clone, Debug)]
-pub struct Sdata {
+struct Sdata {
pub prefix: [Option; 8],
pub prefix_index: usize,
pub last_offset: Size,
@@ -209,7 +209,7 @@ where
arg.cast_to(Uniform::new(Reg::i64(), total));
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/wasm.rs b/compiler/rustc_target/src/abi/call/wasm.rs
index a773fb1e814e0..4ae8b9490ddab 100644
--- a/compiler/rustc_target/src/abi/call/wasm.rs
+++ b/compiler/rustc_target/src/abi/call/wasm.rs
@@ -45,7 +45,7 @@ where
}
/// The purpose of this ABI is to match the C ABI (aka clang) exactly.
-pub fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_c_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
@@ -69,7 +69,7 @@ where
/// This ABI is *bad*! It uses `PassMode::Direct` for `abi::Aggregate` types, which leaks LLVM
/// implementation details into the ABI. It's just hard to fix because ABIs are hard to change.
/// Also see .
-pub fn compute_wasm_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_wasm_abi_info(fn_abi: &mut FnAbi<'_, Ty>) {
if !fn_abi.ret.is_ignore() {
classify_ret_wasm_abi(&mut fn_abi.ret);
}
diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs
index e9aedc3d28a1e..bdb14350ded4b 100644
--- a/compiler/rustc_target/src/abi/call/x86.rs
+++ b/compiler/rustc_target/src/abi/call/x86.rs
@@ -3,12 +3,12 @@ use crate::abi::{Abi, Align, HasDataLayout, TyAbiInterface, TyAndLayout};
use crate::spec::HasTargetSpec;
#[derive(PartialEq)]
-pub enum Flavor {
+pub(crate) enum Flavor {
General,
FastcallOrVectorcall,
}
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/abi/call/x86_64.rs b/compiler/rustc_target/src/abi/call/x86_64.rs
index fcd712489fa40..1209204debfa3 100644
--- a/compiler/rustc_target/src/abi/call/x86_64.rs
+++ b/compiler/rustc_target/src/abi/call/x86_64.rs
@@ -170,7 +170,7 @@ fn cast_target(cls: &[Option], size: Size) -> CastTarget {
const MAX_INT_REGS: usize = 6; // RDI, RSI, RDX, RCX, R8, R9
const MAX_SSE_REGS: usize = 8; // XMM0-7
-pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
diff --git a/compiler/rustc_target/src/abi/call/x86_win64.rs b/compiler/rustc_target/src/abi/call/x86_win64.rs
index 720707ef53f95..e5a20b248e43b 100644
--- a/compiler/rustc_target/src/abi/call/x86_win64.rs
+++ b/compiler/rustc_target/src/abi/call/x86_win64.rs
@@ -4,7 +4,7 @@ use crate::spec::HasTargetSpec;
// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
-pub fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
+pub(crate) fn compute_abi_info(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
let fixup = |a: &mut ArgAbi<'_, Ty>| {
match a.layout.abi {
Abi::Uninhabited | Abi::Aggregate { sized: false } => {}
diff --git a/compiler/rustc_target/src/abi/call/xtensa.rs b/compiler/rustc_target/src/abi/call/xtensa.rs
index addbe6989254c..a1c5e8230cc15 100644
--- a/compiler/rustc_target/src/abi/call/xtensa.rs
+++ b/compiler/rustc_target/src/abi/call/xtensa.rs
@@ -96,7 +96,7 @@ where
}
}
-pub fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
+pub(crate) fn compute_abi_info<'a, Ty, C>(_cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
diff --git a/compiler/rustc_target/src/asm/aarch64.rs b/compiler/rustc_target/src/asm/aarch64.rs
index daf5162e8ac10..74970a26b23bf 100644
--- a/compiler/rustc_target/src/asm/aarch64.rs
+++ b/compiler/rustc_target/src/asm/aarch64.rs
@@ -70,7 +70,7 @@ impl AArch64InlineAsmRegClass {
}
}
-pub fn target_reserves_x18(target: &Target) -> bool {
+pub(crate) fn target_reserves_x18(target: &Target) -> bool {
target.os == "android" || target.os == "fuchsia" || target.is_like_osx || target.is_like_windows
}
diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs
index b2116c5121695..d7c66d6f5e3d6 100644
--- a/compiler/rustc_target/src/lib.rs
+++ b/compiler/rustc_target/src/lib.rs
@@ -17,6 +17,7 @@
#![feature(let_chains)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::path::{Path, PathBuf};
diff --git a/compiler/rustc_target/src/spec/base/aix.rs b/compiler/rustc_target/src/spec/base/aix.rs
index c71c4ba2cc902..e7e9ec663c4c8 100644
--- a/compiler/rustc_target/src/spec/base/aix.rs
+++ b/compiler/rustc_target/src/spec/base/aix.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
abi: "vec-extabi".into(),
code_model: Some(CodeModel::Small),
diff --git a/compiler/rustc_target/src/spec/base/android.rs b/compiler/rustc_target/src/spec/base/android.rs
index 5320f1b4bbbea..dfa0e3fe9899a 100644
--- a/compiler/rustc_target/src/spec/base/android.rs
+++ b/compiler/rustc_target/src/spec/base/android.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, TargetOptions, TlsModel};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.os = "android".into();
base.is_like_android = true;
diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs
index 39d7cf7d0971c..b752a34439537 100644
--- a/compiler/rustc_target/src/spec/base/apple/mod.rs
+++ b/compiler/rustc_target/src/spec/base/apple/mod.rs
@@ -12,7 +12,7 @@ mod tests;
use Arch::*;
#[allow(non_camel_case_types)]
#[derive(Copy, Clone, PartialEq)]
-pub enum Arch {
+pub(crate) enum Arch {
Armv7k,
Armv7s,
Arm64,
@@ -25,7 +25,7 @@ pub enum Arch {
}
impl Arch {
- pub fn target_name(self) -> &'static str {
+ fn target_name(self) -> &'static str {
match self {
Armv7k => "armv7k",
Armv7s => "armv7s",
@@ -39,7 +39,7 @@ impl Arch {
}
}
- pub fn target_arch(self) -> Cow<'static, str> {
+ pub(crate) fn target_arch(self) -> Cow<'static, str> {
Cow::Borrowed(match self {
Armv7k | Armv7s => "arm",
Arm64 | Arm64e | Arm64_32 => "aarch64",
@@ -80,7 +80,7 @@ impl Arch {
}
#[derive(Copy, Clone, PartialEq)]
-pub enum TargetAbi {
+pub(crate) enum TargetAbi {
Normal,
Simulator,
MacCatalyst,
@@ -142,7 +142,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: TargetAbi) -> LinkArgs {
args
}
-pub fn opts(os: &'static str, arch: Arch, abi: TargetAbi) -> TargetOptions {
+pub(crate) fn opts(os: &'static str, arch: Arch, abi: TargetAbi) -> TargetOptions {
TargetOptions {
abi: abi.target_abi().into(),
os: os.into(),
@@ -279,7 +279,7 @@ fn macos_deployment_target(arch: Arch) -> (u32, u32) {
.unwrap_or_else(|| macos_default_deployment_target(arch))
}
-pub fn macos_llvm_target(arch: Arch) -> String {
+pub(crate) fn macos_llvm_target(arch: Arch) -> String {
let (major, minor) = macos_deployment_target(arch);
format!("{}-apple-macosx{}.{}.0", arch.target_name(), major, minor)
}
@@ -333,7 +333,7 @@ fn ios_deployment_target(arch: Arch, abi: &str) -> (u32, u32) {
from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((major, minor))
}
-pub fn ios_llvm_target(arch: Arch) -> String {
+pub(crate) fn ios_llvm_target(arch: Arch) -> String {
// Modern iOS tooling extracts information about deployment target
// from LC_BUILD_VERSION. This load command will only be emitted when
// we build with a version specific `llvm_target`, with the version
@@ -344,12 +344,12 @@ pub fn ios_llvm_target(arch: Arch) -> String {
format!("{}-apple-ios{}.{}.0", arch.target_name(), major, minor)
}
-pub fn mac_catalyst_llvm_target(arch: Arch) -> String {
+pub(crate) fn mac_catalyst_llvm_target(arch: Arch) -> String {
let (major, minor) = ios_deployment_target(arch, "macabi");
format!("{}-apple-ios{}.{}.0-macabi", arch.target_name(), major, minor)
}
-pub fn ios_sim_llvm_target(arch: Arch) -> String {
+pub(crate) fn ios_sim_llvm_target(arch: Arch) -> String {
let (major, minor) = ios_deployment_target(arch, "sim");
format!("{}-apple-ios{}.{}.0-simulator", arch.target_name(), major, minor)
}
@@ -360,12 +360,12 @@ fn tvos_deployment_target() -> (u32, u32) {
from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
}
-pub fn tvos_llvm_target(arch: Arch) -> String {
+pub(crate) fn tvos_llvm_target(arch: Arch) -> String {
let (major, minor) = tvos_deployment_target();
format!("{}-apple-tvos{}.{}.0", arch.target_name(), major, minor)
}
-pub fn tvos_sim_llvm_target(arch: Arch) -> String {
+pub(crate) fn tvos_sim_llvm_target(arch: Arch) -> String {
let (major, minor) = tvos_deployment_target();
format!("{}-apple-tvos{}.{}.0-simulator", arch.target_name(), major, minor)
}
@@ -376,12 +376,12 @@ fn watchos_deployment_target() -> (u32, u32) {
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
}
-pub fn watchos_llvm_target(arch: Arch) -> String {
+pub(crate) fn watchos_llvm_target(arch: Arch) -> String {
let (major, minor) = watchos_deployment_target();
format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor)
}
-pub fn watchos_sim_llvm_target(arch: Arch) -> String {
+pub(crate) fn watchos_sim_llvm_target(arch: Arch) -> String {
let (major, minor) = watchos_deployment_target();
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)
}
@@ -392,12 +392,12 @@ fn visionos_deployment_target() -> (u32, u32) {
from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
}
-pub fn visionos_llvm_target(arch: Arch) -> String {
+pub(crate) fn visionos_llvm_target(arch: Arch) -> String {
let (major, minor) = visionos_deployment_target();
format!("{}-apple-visionos{}.{}.0", arch.target_name(), major, minor)
}
-pub fn visionos_sim_llvm_target(arch: Arch) -> String {
+pub(crate) fn visionos_sim_llvm_target(arch: Arch) -> String {
let (major, minor) = visionos_deployment_target();
format!("{}-apple-visionos{}.{}.0-simulator", arch.target_name(), major, minor)
}
diff --git a/compiler/rustc_target/src/spec/base/avr_gnu.rs b/compiler/rustc_target/src/spec/base/avr_gnu.rs
index c3d0344ea6c13..dd9fc32b69e6c 100644
--- a/compiler/rustc_target/src/spec/base/avr_gnu.rs
+++ b/compiler/rustc_target/src/spec/base/avr_gnu.rs
@@ -6,7 +6,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
///
/// Requires GNU avr-gcc and avr-binutils on the host system.
/// FIXME: Remove the second parameter when const string concatenation is possible.
-pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
+pub(crate) fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
Target {
arch: "avr".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/base/bpf.rs b/compiler/rustc_target/src/spec/base/bpf.rs
index 4d03747d0165f..17d5e75ef6d01 100644
--- a/compiler/rustc_target/src/spec/base/bpf.rs
+++ b/compiler/rustc_target/src/spec/base/bpf.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions};
-pub fn opts(endian: Endian) -> TargetOptions {
+pub(crate) fn opts(endian: Endian) -> TargetOptions {
TargetOptions {
allow_asm: true,
endian,
diff --git a/compiler/rustc_target/src/spec/base/dragonfly.rs b/compiler/rustc_target/src/spec/base/dragonfly.rs
index 3c1846696f7a4..5da23f2b8fda1 100644
--- a/compiler/rustc_target/src/spec/base/dragonfly.rs
+++ b/compiler/rustc_target/src/spec/base/dragonfly.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "dragonfly".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/freebsd.rs b/compiler/rustc_target/src/spec/base/freebsd.rs
index c772754aa8ddc..a016489e52dcd 100644
--- a/compiler/rustc_target/src/spec/base/freebsd.rs
+++ b/compiler/rustc_target/src/spec/base/freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "freebsd".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/fuchsia.rs b/compiler/rustc_target/src/spec/base/fuchsia.rs
index d1ac22f3a098c..fc3d9f6fb9ff6 100644
--- a/compiler/rustc_target/src/spec/base/fuchsia.rs
+++ b/compiler/rustc_target/src/spec/base/fuchsia.rs
@@ -2,7 +2,7 @@ use crate::spec::{
crt_objects, cvs, Cc, FramePointer, LinkOutputKind, LinkerFlavor, Lld, TargetOptions,
};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
// This mirrors the linker options provided by clang. We presume lld for
// now. When using clang as the linker it will supply these options for us,
// so we only list them for ld/lld.
diff --git a/compiler/rustc_target/src/spec/base/haiku.rs b/compiler/rustc_target/src/spec/base/haiku.rs
index 8ab874410aa1c..d90e4c99f93e3 100644
--- a/compiler/rustc_target/src/spec/base/haiku.rs
+++ b/compiler/rustc_target/src/spec/base/haiku.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "haiku".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/hermit.rs b/compiler/rustc_target/src/spec/base/hermit.rs
index c6e98fc1a115f..971abef80d9b1 100644
--- a/compiler/rustc_target/src/spec/base/hermit.rs
+++ b/compiler/rustc_target/src/spec/base/hermit.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, TargetOptions, TlsModel};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "hermit".into(),
linker: Some("rust-lld".into()),
diff --git a/compiler/rustc_target/src/spec/base/hurd.rs b/compiler/rustc_target/src/spec/base/hurd.rs
index 76f8223c0e4ed..d464d50ecc28c 100644
--- a/compiler/rustc_target/src/spec/base/hurd.rs
+++ b/compiler/rustc_target/src/spec/base/hurd.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "hurd".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/hurd_gnu.rs b/compiler/rustc_target/src/spec/base/hurd_gnu.rs
index 3501dbdea1b59..70d423217a60c 100644
--- a/compiler/rustc_target/src/spec/base/hurd_gnu.rs
+++ b/compiler/rustc_target/src/spec/base/hurd_gnu.rs
@@ -1,5 +1,5 @@
use crate::spec::{base, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..base::hurd::opts() }
}
diff --git a/compiler/rustc_target/src/spec/base/illumos.rs b/compiler/rustc_target/src/spec/base/illumos.rs
index f0a648b93ad04..fa743a0c66d8d 100644
--- a/compiler/rustc_target/src/spec/base/illumos.rs
+++ b/compiler/rustc_target/src/spec/base/illumos.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, FramePointer, LinkerFlavor, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let late_link_args = TargetOptions::link_args(
LinkerFlavor::Unix(Cc::Yes),
&[
diff --git a/compiler/rustc_target/src/spec/base/l4re.rs b/compiler/rustc_target/src/spec/base/l4re.rs
index 3a4d83fad1751..dbe9e78a193b9 100644
--- a/compiler/rustc_target/src/spec/base/l4re.rs
+++ b/compiler/rustc_target/src/spec/base/l4re.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "l4re".into(),
env: "uclibc".into(),
diff --git a/compiler/rustc_target/src/spec/base/linux.rs b/compiler/rustc_target/src/spec/base/linux.rs
index 34b2eb0f64174..2e30364525e6b 100644
--- a/compiler/rustc_target/src/spec/base/linux.rs
+++ b/compiler/rustc_target/src/spec/base/linux.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{cvs, RelroLevel, SplitDebuginfo, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "linux".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/linux_gnu.rs b/compiler/rustc_target/src/spec/base/linux_gnu.rs
index 3491277c44077..1200add4fe1e2 100644
--- a/compiler/rustc_target/src/spec/base/linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/base/linux_gnu.rs
@@ -1,5 +1,5 @@
use crate::spec::{base, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions { env: "gnu".into(), ..base::linux::opts() }
}
diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
index 42aa1e1a6daf4..a29635112fffa 100644
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, crt_objects, LinkSelfContainedDefault, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.env = "musl".into();
diff --git a/compiler/rustc_target/src/spec/base/linux_ohos.rs b/compiler/rustc_target/src/spec/base/linux_ohos.rs
index 8272cda05e791..2372bc2c71814 100644
--- a/compiler/rustc_target/src/spec/base/linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/base/linux_ohos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, TargetOptions, TlsModel};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.env = "ohos".into();
diff --git a/compiler/rustc_target/src/spec/base/linux_uclibc.rs b/compiler/rustc_target/src/spec/base/linux_uclibc.rs
index 540344e9e94d1..80a6479bb5f9a 100644
--- a/compiler/rustc_target/src/spec/base/linux_uclibc.rs
+++ b/compiler/rustc_target/src/spec/base/linux_uclibc.rs
@@ -1,5 +1,5 @@
use crate::spec::{base, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions { env: "uclibc".into(), ..base::linux::opts() }
}
diff --git a/compiler/rustc_target/src/spec/base/msvc.rs b/compiler/rustc_target/src/spec/base/msvc.rs
index 720cf03005a5e..b0fb2ef4b27f2 100644
--- a/compiler/rustc_target/src/spec/base/msvc.rs
+++ b/compiler/rustc_target/src/spec/base/msvc.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
// Suppress the verbose logo and authorship debugging output, which would needlessly
// clog any log files.
let pre_link_args = TargetOptions::link_args(LinkerFlavor::Msvc(Lld::No), &["/NOLOGO"]);
diff --git a/compiler/rustc_target/src/spec/base/netbsd.rs b/compiler/rustc_target/src/spec/base/netbsd.rs
index 495e3d10fbccd..1ae81eb0633ef 100644
--- a/compiler/rustc_target/src/spec/base/netbsd.rs
+++ b/compiler/rustc_target/src/spec/base/netbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "netbsd".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/nto_qnx.rs b/compiler/rustc_target/src/spec/base/nto_qnx.rs
index f1405e9b44667..47177415b3942 100644
--- a/compiler/rustc_target/src/spec/base/nto_qnx.rs
+++ b/compiler/rustc_target/src/spec/base/nto_qnx.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
crt_static_respected: true,
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/openbsd.rs b/compiler/rustc_target/src/spec/base/openbsd.rs
index bc3aecb5c1e83..942ac4a393c5c 100644
--- a/compiler/rustc_target/src/spec/base/openbsd.rs
+++ b/compiler/rustc_target/src/spec/base/openbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions, TlsModel};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "openbsd".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/redox.rs b/compiler/rustc_target/src/spec/base/redox.rs
index 9070791e9dfc4..3f13f1f884195 100644
--- a/compiler/rustc_target/src/spec/base/redox.rs
+++ b/compiler/rustc_target/src/spec/base/redox.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "redox".into(),
env: "relibc".into(),
diff --git a/compiler/rustc_target/src/spec/base/solaris.rs b/compiler/rustc_target/src/spec/base/solaris.rs
index f97cdb4fb2842..1529cd65b28c4 100644
--- a/compiler/rustc_target/src/spec/base/solaris.rs
+++ b/compiler/rustc_target/src/spec/base/solaris.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "solaris".into(),
dynamic_linking: true,
diff --git a/compiler/rustc_target/src/spec/base/solid.rs b/compiler/rustc_target/src/spec/base/solid.rs
index ce4a8869001bc..fd55e1d150141 100644
--- a/compiler/rustc_target/src/spec/base/solid.rs
+++ b/compiler/rustc_target/src/spec/base/solid.rs
@@ -1,6 +1,6 @@
use crate::spec::{FramePointer, TargetOptions};
-pub fn opts(kernel: &str) -> TargetOptions {
+pub(crate) fn opts(kernel: &str) -> TargetOptions {
TargetOptions {
os: format!("solid_{kernel}").into(),
vendor: "kmc".into(),
diff --git a/compiler/rustc_target/src/spec/base/teeos.rs b/compiler/rustc_target/src/spec/base/teeos.rs
index 38d0a6d73140a..94eb946dda46b 100644
--- a/compiler/rustc_target/src/spec/base/teeos.rs
+++ b/compiler/rustc_target/src/spec/base/teeos.rs
@@ -1,6 +1,6 @@
use crate::spec::{add_link_args, Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"];
let cc_args = &["-Wl,-zmax-page-size=4096", "-Wl,-znow", "-Wl,-ztext", "-mexecute-only"];
diff --git a/compiler/rustc_target/src/spec/base/thumb.rs b/compiler/rustc_target/src/spec/base/thumb.rs
index 0decfecb4cd1d..03ec679038c08 100644
--- a/compiler/rustc_target/src/spec/base/thumb.rs
+++ b/compiler/rustc_target/src/spec/base/thumb.rs
@@ -29,7 +29,7 @@
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
// See rust-lang/rfcs#1645 for a discussion about these defaults
TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
diff --git a/compiler/rustc_target/src/spec/base/uefi_msvc.rs b/compiler/rustc_target/src/spec/base/uefi_msvc.rs
index e8acd6078e2ad..0020106f40e87 100644
--- a/compiler/rustc_target/src/spec/base/uefi_msvc.rs
+++ b/compiler/rustc_target/src/spec/base/uefi_msvc.rs
@@ -11,7 +11,7 @@
use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut base = base::msvc::opts();
base.add_pre_link_args(
diff --git a/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs
index 9ccd0a1e7caec..fd81381572438 100644
--- a/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, PanicStrategy, RelocModel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "linux".into(),
env: "musl".into(),
diff --git a/compiler/rustc_target/src/spec/base/vxworks.rs b/compiler/rustc_target/src/spec/base/vxworks.rs
index aa4784b63e7aa..425dd3c8cc232 100644
--- a/compiler/rustc_target/src/spec/base/vxworks.rs
+++ b/compiler/rustc_target/src/spec/base/vxworks.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "vxworks".into(),
env: "gnu".into(),
diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs
index f237391016e77..e417137ced1b1 100644
--- a/compiler/rustc_target/src/spec/base/wasm.rs
+++ b/compiler/rustc_target/src/spec/base/wasm.rs
@@ -3,7 +3,7 @@ use crate::spec::{
TargetOptions, TlsModel,
};
-pub fn options() -> TargetOptions {
+pub(crate) fn options() -> TargetOptions {
macro_rules! args {
($prefix:literal) => {
&[
diff --git a/compiler/rustc_target/src/spec/base/windows_gnu.rs b/compiler/rustc_target/src/spec/base/windows_gnu.rs
index 7346e42dd9100..1393b1591842f 100644
--- a/compiler/rustc_target/src/spec/base/windows_gnu.rs
+++ b/compiler/rustc_target/src/spec/base/windows_gnu.rs
@@ -5,7 +5,7 @@ use crate::spec::{
Lld, SplitDebuginfo, TargetOptions,
};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::No, Lld::No),
&[
diff --git a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
index 88c3b8a81ad22..9e89a3c75fead 100644
--- a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
+++ b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
// We cannot use `-nodefaultlibs` because compiler-rt has to be passed
// as a path since it's not added to linker search path by the default.
// There were attempts to make it behave like libgcc (so one can just use -l)
diff --git a/compiler/rustc_target/src/spec/base/windows_msvc.rs b/compiler/rustc_target/src/spec/base/windows_msvc.rs
index bd0318f31832a..5301e3ff65441 100644
--- a/compiler/rustc_target/src/spec/base/windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/base/windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, cvs, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let base = base::msvc::opts();
TargetOptions {
diff --git a/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs b/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs
index 17256e18e24e3..8134b5feade9f 100644
--- a/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs
+++ b/compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{add_link_args, base, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let base = base::windows_gnu::opts();
// FIXME: This should be updated for the exception machinery changes from #67502
diff --git a/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs b/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs
index 59a7616712541..f4f712145047e 100644
--- a/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs
+++ b/compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, LinkerFlavor, Lld, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
let mut opts = base::windows_msvc::opts();
opts.abi = "uwp".into();
diff --git a/compiler/rustc_target/src/spec/base/xtensa.rs b/compiler/rustc_target/src/spec/base/xtensa.rs
index 31ad09c52e4fd..280dd16e26453 100644
--- a/compiler/rustc_target/src/spec/base/xtensa.rs
+++ b/compiler/rustc_target/src/spec/base/xtensa.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions};
-pub fn opts() -> TargetOptions {
+pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "none".into(),
endian: Endian::Little,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
index 65f2a1e306987..912392c9fef08 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("macos", arch, TargetAbi::Normal);
base.cpu = "apple-m1".into();
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
index 11a39c26e9d25..7f3a86f3256ff 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("ios", arch, TargetAbi::Normal);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
index 32c2367d5bfdb..e60eeda429565 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("ios", arch, TargetAbi::MacCatalyst);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
index 703b886cc19ec..d605e22701af0 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("ios", arch, TargetAbi::Simulator);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
index e97ad11cdf6c5..fc774ab94c880 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, tvos_llvm_target, Arch, TargetAbi};
use crate::spec::{FramePointer, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
Target {
llvm_target: tvos_llvm_target(arch).into(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
index 8bfa9c8e8b7e1..8e8bb1efc9dfe 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch, TargetAbi};
use crate::spec::{FramePointer, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
Target {
llvm_target: tvos_sim_llvm_target(arch).into(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs
index b0798e5e4f580..16c7d72daed85 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, visionos_llvm_target, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("visionos", arch, TargetAbi::Normal);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs
index 7b2d2b6a8e442..42973e0268e12 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, visionos_sim_llvm_target, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
let mut base = opts("visionos", arch, TargetAbi::Simulator);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs
index 6d66299d6d9e0..03fc2518d1d6b 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = opts("watchos", Arch::Arm64, TargetAbi::Normal);
Target {
llvm_target: "aarch64-apple-watchos".into(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
index 9675a950d5d08..13e2b96179481 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch, TargetAbi};
use crate::spec::{FramePointer, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64;
Target {
// Clang automatically chooses a more specific target based on
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
index df389fe34bd69..5b8efd6626287 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64_be-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
index 10a8e3e4df818..c14fa20b6973d 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
index ba646cd6065fc..fe4dadfe8382d 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64_be-unknown-netbsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs
index 3668db912bb81..144ac85622eef 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_fuchsia.rs
@@ -1 +1 @@
-pub use crate::spec::targets::aarch64_unknown_fuchsia::target;
+pub(crate) use crate::spec::targets::aarch64_unknown_fuchsia::target;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
index 1c2273bb3a1f3..1d054dad568a8 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, RelocModel, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = base::solid::opts("asp3");
Target {
llvm_target: "aarch64-unknown-none".into(),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
index 3f0072c00c149..ff0a0762e3c80 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
// for target ABI requirements.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-linux-android".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
index 1ba4fbb3d256b..d6d49a4a07044 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_nintendo_switch_freestanding.rs
@@ -5,7 +5,7 @@ use crate::spec::{
const LINKER_SCRIPT: &str = include_str!("./aarch64_nintendo_switch_freestanding_linker_script.ld");
/// A base target for Nintendo Switch devices using a pure LLVM toolchain.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-none".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs
index 070460538c7a3..9d10358a49f80 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_gnullvm::opts();
base.max_atomic_width = Some(128);
base.features = "+v8a,+neon,+fp-armv8".into();
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs
index f4e2ee448057a..c3bd2ea6c332b 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.max_atomic_width = Some(128);
base.features = "+v8a,+neon,+fp-armv8".into();
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
index b10f1c7592e51..b993275ff8314 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-freebsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
index f84853fbb19c4..b462739e5617b 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-fuchsia".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
index 55cb0b8f2ee78..e9da6a8f3ceb8 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-hermit".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs
index 7f05358e01610..bed9c88fd670b 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::illumos::opts();
base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-std=c99"]);
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
index 1a45c2c5c05ef..56709f788d3eb 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
index 851366b7647bc..71b331972cc0d 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-linux-gnu_ilp32".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 6b4a422a474a0..1cf71b650409c 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.max_atomic_width = Some(128);
base.supports_xray = true;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
index 726a85c81f39f..0dbf4cb7a705c 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_ohos::opts();
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
index 0069d5431f8e5..e25beec0a1376 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-netbsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
index 169468f2e2482..54a08853c2860 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs
@@ -11,7 +11,7 @@ use crate::spec::{
TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let opts = TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
index 222d5651b5211..7933041b584ec 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
@@ -10,7 +10,7 @@ use crate::spec::{
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs
index 0e5a0b9b9a545..12dd25fa28119 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::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-unknown".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
index e16991af4e665..8f6215df71a41 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-openbsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
index e59b38a3e4116..26c1a67109558 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::redox::opts();
base.max_atomic_width = Some(128);
base.stack_probes = StackProbeType::Inline;
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
index 5ae2d68332c6e..4e3d5ce34bc50 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::teeos::opts();
base.features = "+strict-align,+neon,+fp-armv8".into();
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs
index 9fd7c24649896..69ab992e12ca1 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs
@@ -2,7 +2,7 @@
use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-unknown-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
index 429303170b6b8..bb580af7c4756 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
@@ -3,7 +3,7 @@
use crate::spec::{base, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::uefi_msvc::opts();
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs
index df1b75272b1fe..630658efd0675 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_uwp_msvc::opts();
base.max_atomic_width = Some(128);
base.features = "+v8a".into();
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
index 41f7532ecdb19..3c0f92fa31fef 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
index 2c76f4736de8e..f292ee7f56312 100644
--- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
+++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, watchos_llvm_target, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64_32;
let base = opts("watchos", arch, TargetAbi::Normal);
Target {
diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs
index 6f28f5d054360..e86b8358a9c98 100644
--- a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64e;
let mut base = opts("macos", arch, TargetAbi::Normal);
base.cpu = "apple-m1".into();
diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs
index 1590ae9679d88..fcb850f44bc85 100644
--- a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Arm64e;
let mut base = opts("ios", arch, TargetAbi::Normal);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs
index 21cb38868fb92..50c399bf4a88b 100644
--- a/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{add_link_args, base, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.max_atomic_width = Some(128);
base.features = "+v8a,+neon,+fp-armv8".into();
diff --git a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs
index a22bcef47575c..350a01b196714 100644
--- a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "arm-linux-androideabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs
index 8ff272e786db0..296f9d0b423d7 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "arm-unknown-linux-gnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs
index e3e2f4cd05c2a..5d58055f1af35 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "arm-unknown-linux-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
index f958b89358b18..89a80ae8bedd6 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// to determine the calling convention and float ABI, and it doesn't
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
index 98093fdc00324..200bb91796484 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and it
diff --git a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs
index b56f311793adc..a6ea48817c04f 100644
--- a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armeb-unknown-linux-gnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs
index df32b74f6d9ac..d09624e0e7391 100644
--- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs
@@ -3,7 +3,7 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armebv7r-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs
index 063038c801222..10669dcf09d79 100644
--- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs
@@ -3,7 +3,7 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armebv7r-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs
index f873fb0d34957..2236e02d006fa 100644
--- a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs
@@ -11,7 +11,7 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv4t-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs
index 18f327bc87f7f..d88022ac10a2a 100644
--- a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv4t-unknown-linux-gnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs
index 1fbe4b89ea177..3d8e75d3ee952 100644
--- a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, cvs, FramePointer, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv5te-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs
index 123686448378e..a73d8298ddeed 100644
--- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv5te-unknown-linux-gnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
index ccbc1e36ddece..91b0e2039c7f4 100644
--- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// FIXME: this comment below does not seem applicable?
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs
index d88b88333b56d..65658ab45fc49 100644
--- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv5te-unknown-linux-uclibcgnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs
index 24e9d1e039494..52617237f207a 100644
--- a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv6-unknown-freebsd-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs
index 62e328b9cbda2..eda1c028aad3a 100644
--- a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv6-unknown-netbsdelf-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs
index bcdad0a55b316..b29ee2dd793b1 100644
--- a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs
+++ b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs
@@ -4,7 +4,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}
///
/// Requires the devkitARM toolchain for 3DS targets on the host system.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-specs=3dsx.specs", "-mtune=mpcore", "-mfloat-abi=hard", "-mtp=soft"],
diff --git a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs
index 8f6a58a1b4982..3bba22f8a1fa7 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs
@@ -8,7 +8,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptio
// See https://developer.android.com/ndk/guides/abis.html#v7a
// for target ABI requirements.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::android::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]);
Target {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs
index a9b5172385ba7..5f71d325efb0a 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs
@@ -5,7 +5,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}
///
/// Requires the VITASDK toolchain on the host system.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
&["-Wl,-q", "-Wl,--pic-veneer"],
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs
index 3a16bbe95db34..b955acd0dca97 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-freebsd-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs
index 8a4ba271456a9..703a9b132b2d9 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
// hardfloat.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs
index a217a2daeb39e..db79810b5dd7d 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for glibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
index 96459a5137fd1..e4e99eab853af 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
// hardfloat.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
// Most of these settings are copied from the armv7_unknown_linux_gnueabi
// target.
Target {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
index 6c878141fd495..5fc3f7031753d 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
@@ -2,7 +2,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and LLVM
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs
index bffc51d9b7bca..040a953b12e94 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
// hardfloat.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
// Most of these settings are copied from the armv7_unknown_linux_musleabi
// target.
Target {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs
index 9dc1221287dd0..af10d2d90123d 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for uclibc Linux on ARMv7 without NEON,
// thumb-mode or hardfloat.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = base::linux_uclibc::opts();
Target {
llvm_target: "armv7-unknown-linux-gnueabi".into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs
index 01a1468d3a8c9..53673daa8129b 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, Target, TargetOptions};
// This target is for uclibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = base::linux_uclibc::opts();
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs
index a2391503ff8ab..164acd17f21ee 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-netbsdelf-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs
index 889cc20156979..1ad91b8f080e7 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs
@@ -1,6 +1,6 @@
use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// to determine the calling convention and float ABI, and it doesn't
diff --git a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs
index 7d60ec1b64dda..f8faec918e4d6 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs
index 76d4653931b88..aea897f56b885 100644
--- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = base::solid::opts("asp3");
Target {
llvm_target: "armv7a-none-eabi".into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs
index d2b4d46adac6b..be526d6325004 100644
--- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let base = base::solid::opts("asp3");
Target {
llvm_target: "armv7a-none-eabihf".into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs
index b544c404f3f21..1e4798abfffb0 100644
--- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs
@@ -16,7 +16,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "eabi".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs
index aebb7e667bcd8..ab8b870c62859 100644
--- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs
@@ -7,7 +7,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "eabihf".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
diff --git a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
index e876c567b09a1..35de6b35eaf2e 100644
--- a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Armv7k;
Target {
llvm_target: "armv7k-apple-watchos".into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs
index b3246dc792811..aba55f533a71d 100644
--- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7r-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs
index 9ac500d7ffe7e..5a8519dcc49d0 100644
--- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs
@@ -2,7 +2,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7r-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs
index 11608794932b3..41eaa79d3eb22 100644
--- a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::Armv7s;
Target {
llvm_target: ios_llvm_target(arch).into(),
diff --git a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs
index ee940c3a76a24..042a9a140710c 100644
--- a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs
@@ -2,7 +2,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv8r-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs b/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs
index bf01413a80adf..020322b27391d 100644
--- a/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs
+++ b/compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs
@@ -1,5 +1,5 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
base::avr_gnu::target("atmega328", "-mmcu=atmega328")
}
diff --git a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs
index eb223af8cf44f..f4c3a35ced585 100644
--- a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "bpfeb".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs
index 12164adc00f25..6ef72c4021050 100644
--- a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "bpfel".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs
index e8a0b465e1562..61c246fc4cbf8 100644
--- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs
+++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs
@@ -2,7 +2,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
// This target is for glibc Linux on Csky
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
//https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h
llvm_target: "csky-unknown-linux-gnuabiv2".into(),
diff --git a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs
index 99330ddc31894..91c33caae3e2a 100644
--- a/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs
+++ b/compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs
@@ -2,7 +2,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
// This target is for glibc Linux on Csky
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
//https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h
llvm_target: "csky-unknown-linux-gnuabiv2".into(),
diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs
index bd53979902969..cddc3a33f9fb3 100644
--- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "hexagonv60".into();
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs
index cefd0bf6d67b7..730b19abd2bd4 100644
--- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{PanicStrategy, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "hexagon-unknown-none-elf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
index b1b2b6cdffa8d..263393fd536ce 100644
--- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::I386;
// i386-apple-ios is a simulator target, even though it isn't declared
// that way in the target name like the other ones...
diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
index 6c80ab6994ddc..cf0577d8cb01a 100644
--- a/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "i586-pc-unknown".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs
index befb0f89f3b03..dd38f86bced2e 100644
--- a/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::Target;
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = super::i686_pc_windows_msvc::target();
base.cpu = "pentium".into();
base.llvm_target = "i586-pc-windows-msvc".into();
diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs
index b699a7af17749..e481e967ebfa2 100644
--- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::Target;
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = super::i686_unknown_linux_gnu::target();
base.cpu = "pentium".into();
base.llvm_target = "i586-unknown-linux-gnu".into();
diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
index 55a26eb004a7a..623422a89ea62 100644
--- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::Target;
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = super::i686_unknown_linux_musl::target();
base.cpu = "pentium".into();
base.llvm_target = "i586-unknown-linux-musl".into();
diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs
index de42549b7f8df..3c5ba157c1ecc 100644
--- a/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.cpu = "pentium".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
index 02f6bec4692fc..f173e8b7e4ae8 100644
--- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
// ld64 only understands i386 and not i686
let arch = Arch::I386;
let mut base = opts("macos", arch, TargetAbi::Normal);
diff --git a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
index fc313e575be6e..bce41976a9697 100644
--- a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
@@ -3,7 +3,7 @@ use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
// See https://developer.android.com/ndk/guides/abis.html#x86
// for target ABI requirements.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::android::opts();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs
index 4b0f4bf3ecd25..7288359f564af 100644
--- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_gnu::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs
index 5bb082014298a..a38e67b96f0db 100644
--- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_gnullvm::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs
index 970b43ad109ba..a8e1ad45014ac 100644
--- a/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, LinkerFlavor, Lld, SanitizerSet, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
index cce21fcacb1c5..8ba58dfd705ba 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::freebsd::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
index 84ef00f06c810..b2316fd3bf422 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::haiku::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs
index ad8c0f7f582e7..2e303ff402fa6 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::hurd_gnu::opts();
base.cpu = "pentiumpro".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
index 5584435a0ad9d..15bc4da1775a0 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
index d1ab1f73b511b..8dd08a9567b46 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
index 255148fca9a31..02a95ee6626f2 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
index d6df801234c66..b8c9efc7c471a 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::openbsd::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs
index 83252fadb78ea..0e00249d66cf7 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::redox::opts();
base.cpu = "pentiumpro".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs
index b92fc2e759a30..3cda78003edbe 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs
@@ -7,7 +7,7 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::uefi_msvc::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs
index 851bea80fb830..901c9fc378d21 100644
--- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_uwp_gnu::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs
index 28bd2aae8e711..c7703666ae032 100644
--- a/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_uwp_msvc::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
index cd488d0532c2f..79302cdc0a1a3 100644
--- a/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
index 973c75eeca6e1..ba669334e7f4d 100644
--- a/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::vxworks::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
index 6f0bb449c16c0..d33c7af92c656 100644
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "loongarch64-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs
index f7a6e0bd857f5..5540e71ad4f31 100644
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "loongarch64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
index c7f47da6972e7..5628519026831 100644
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
@@ -2,7 +2,7 @@ use crate::spec::{
Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "loongarch64-unknown-none".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
index 21e4f4a2b057b..7e57715ce7a73 100644
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
@@ -2,7 +2,7 @@ use crate::spec::{
Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "loongarch64-unknown-none".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs
index 7cff0efd112c8..9d9f6145e2f5d 100644
--- a/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "M68020".into();
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs
index c3235bf994fa0..72577749ac64f 100644
--- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs
@@ -3,7 +3,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "mips64r2".into();
base.features = "+mips64r2,+soft-float".into();
diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs
index cdf4ffb7f9eb5..1fad6be2f8df3 100644
--- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mips64-unknown-linux-gnuabi64".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
index 463f7dc47f72f..7627131bc2fe6 100644
--- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "mips64r2".into();
base.features = "+mips64r2".into();
diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
index ad77a02c0630e..f93e5676b051d 100644
--- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mips64el-unknown-linux-gnuabi64".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
index 83f5c7ea37d63..6fbb4f40024d9 100644
--- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "mips64r2".into();
base.features = "+mips64r2".into();
diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs
index 0bdfd6ee6b09d..778b0041214db 100644
--- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mips-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs
index 8e27c9936c561..2cce3271c57f8 100644
--- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "mips32r2".into();
base.features = "+mips32r2,+soft-float".into();
diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs
index 852e1d9376d08..ef7d6bf82e321 100644
--- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs
+++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mips-unknown-linux-uclibc".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs
index 9d3f4d9f79501..850808b4c7ba1 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs
@@ -3,7 +3,7 @@ use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}
// The PSP has custom linker requirements.
const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::No, Lld::No),
&["--emit-relocs", "--nmagic"],
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs
index c0b99a68b0d07..761495b2a29fb 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsel-sony-psx".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs
index 8fe4548a3ad95..2784b3714690c 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsel-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs
index 43914a2330800..1b2d8e9a105f2 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "mips32r2".into();
base.features = "+mips32r2,+soft-float".into();
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs
index 6150654c0817e..21f03a40ec2d5 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsel-unknown-linux-uclibc".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs
index 03501aa76a83f..ea2fb2e7f3aad 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.max_atomic_width = Some(32);
base.cpu = "mips32".into();
diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs
index 81aac3ce0b87f..bb8eb24908c23 100644
--- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_none.rs
@@ -4,7 +4,7 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsel-unknown-none".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs
index 2ed520e9f48ff..5c07e9ea6dddb 100644
--- a/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsisa32r6-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs
index de30c5b35b75b..63b3cc47ffc26 100644
--- a/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsisa32r6el-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs
index 4178a991e14fe..7f5e2edb03613 100644
--- a/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs
index 8e50373bd124b..a2d807bcfe1b9 100644
--- a/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs
index de476741defd6..5bc5f79d1b6c6 100644
--- a/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/msp430_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "msp430-none-elf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs
index ec5edfb6e42c2..289251e906a0c 100644
--- a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs
+++ b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs
@@ -2,7 +2,7 @@ use crate::spec::{
LinkSelfContainedDefault, LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
arch: "nvptx64".into(),
data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
index bda43e7a2b0f1..0f90efb4bb3db 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::aix::opts();
base.max_atomic_width = Some(64);
base.add_pre_link_args(
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
index 6eb5bba0fcd99..89afe2343768e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::freebsd::opts();
base.cpu = "ppc64".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
index 53b84479a4919..e39849c9b1883 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "ppc64".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
index 0d0484dd17480..24a56f917e5d5 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "ppc64".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
index 2922c921e17d1..1dab74e93762e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::openbsd::opts();
base.cpu = "ppc64".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
index dd2ec27420762..1029a135e4aa7 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::vxworks::opts();
base.cpu = "ppc64".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
index ea295cf169e0e..3c9d01e2d18d0 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::freebsd::opts();
base.cpu = "ppc64le".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
index dc70bd238a749..df8f9f07c2f3e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "ppc64le".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
index dbfbd69b95b17..909a25304f46f 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "ppc64le".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs
index 2f7acccfae83b..e8f09d70cc844 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::freebsd::opts();
// Extra hint to linker that we are generating secure-PLT code.
base.add_pre_link_args(
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs
index 2ecafbb08bc33..9e5cea6eff586 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs
index 04b2309fdc887..dbea70168a52a 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
index 108e468eb66ba..86840f16d902c 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
index d19015729ec19..51cd3c186fa9a 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs
index 3ee6cd46c8535..7129fe42876d3 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs
index f00ee9604137f..6e98ecce45b74 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::openbsd::opts();
base.endian = Endian::Big;
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs
index 5d107d6e60ecd..b19513bf1d7c9 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::vxworks::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "--secure-plt"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs
index aea525a69123f..8484c160a99c2 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::vxworks::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe", "--secure-plt"]);
base.max_atomic_width = Some(32);
diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs
index e425d6a3f3fcb..8913df3b95465 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv32-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
index 409b6b22f1cf9..5717e7a390754 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv32-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
index 631a31edeb5ec..1995de9dd2d7e 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32i_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs
index 8aa5e0988902e..bd37cf80b4833 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
index 5fa3858e85744..32df30ddb5e3d 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32im_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs
index 2022873d05cb5..61c887031bcf2 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32ima_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs
index 386e3a38f9757..0d453901efa73 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs
index 7ced37e153577..cc28198e3ff0a 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs
index aa51b8957fcd5..5ee6b3cbfa6ee 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
index cd50a9e60c32d..0eaabc60cbcd0 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imac_unknown_xous_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs
index 3661e38e7b1b3..c2882151d3d18 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs
index 954660908912f..7395e1a6aad23 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs
index fe49951ebfd6e..dcd4fcd9b4836 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs
index d52dc8f96ca27..50d36e724a2c3 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
index ff9931978466e..0ae49debc3a38 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_none_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs
index baee03e68333c..eab18064334a5 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs
@@ -1,6 +1,6 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
llvm_target: "riscv32".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs
index 2dfaf8a2033c6..00059a2691dc2 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{base, CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-linux-android".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs
index 1fd6a4b38dcf1..8d2b16c45016e 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, CodeModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-freebsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs
index 5c3f525966ed8..f5e6b1cbd78f4 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, CodeModel, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-fuchsia".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs
index f11128cfcb676..3033479358ecd 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, CodeModel, RelocModel, Target, TargetOptions, TlsModel};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-hermit".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs
index 308c995297bba..07253803f5c2e 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs
index 8b40132986867..9b0b14cb1088d 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs
index 65781f5af5c74..3eb9366c850b6 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, CodeModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-netbsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs
index 61226809e52a2..c32c57d92f75b 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs
@@ -3,7 +3,7 @@ use crate::spec::{
TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs
index 5bea708e0dd23..27b8ae99753bc 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs
@@ -3,7 +3,7 @@ use crate::spec::{
TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs
index 5bdbda773b1bf..dca8a524b103f 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, CodeModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-openbsd".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs
index b7444df04cd1f..d514f8efcd08c 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs
@@ -3,7 +3,7 @@ use crate::spec::{
TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
llvm_target: "riscv64".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs
index 215c0724f91de..9a9451aa4f32c 100644
--- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs
@@ -3,7 +3,7 @@ use crate::spec::{
TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
index b0dd0eb612e16..e0a6c230fd6ae 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
index 3976233819cec..6aabe9ca51923 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM
diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs
index eeb7eebfe5035..7c37fa0d63259 100644
--- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.endian = Endian::Big;
base.cpu = "v9".into();
diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs
index 69bb6e1fb60e4..842e35392dcea 100644
--- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.cpu = "v9".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs
index 08f6eaf836176..a8767fa9d3c06 100644
--- a/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::openbsd::opts();
base.endian = Endian::Big;
base.cpu = "v9".into();
diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs
index 8b7ff5d8011cf..7089fc511242a 100644
--- a/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "sparc-unknown-linux-gnu".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs
index c977fe608a78e..0cd4faefd6bb1 100644
--- a/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/sparc_unknown_none_elf.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let options = TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
linker: Some("sparc-elf-gcc".into()),
diff --git a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs
index 1c0adadece0be..a932632b85740 100644
--- a/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs
+++ b/compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs
@@ -1,7 +1,7 @@
use crate::abi::Endian;
use crate::spec::{base, Cc, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::solaris::opts();
base.endian = Endian::Big;
base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64"]);
diff --git a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs
index 8806f3e87fa2a..0f5e16408932f 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs
@@ -11,7 +11,7 @@
use crate::spec::{base, cvs, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv4t-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs
index d92e68cebaa65..6ae41ce439939 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, cvs, FramePointer, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv5te-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs
index a0fa58d8175cf..9d4cc66c7f075 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv6m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs
index ac37f40386012..bc9d9856e036e 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv6m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs
index e36aa5ab395da..a927cf6902e92 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
// Prevent error LNK2013: BRANCH24(T) fixup overflow
// The LBR optimization tries to eliminate branch islands,
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs
index 2e68dd0ec4e8a..473113854a81b 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, PanicStrategy, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7a-pc-windows-msvc".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs
index bd2df9236f67b..dca3e73dda570 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs
@@ -11,7 +11,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7em-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs
index e2499ef54112b..acc5acfbfb684 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs
@@ -10,7 +10,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7em-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs
index e21facb78f961..b4cd9686f5cc9 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs
@@ -11,7 +11,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7em-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs
index 45092711d2e18..bdb3a38be9391 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs
@@ -10,7 +10,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7em-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs
index 17e37f800f0b5..f5615de231544 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs
index 4424b9eaadea6..0e3663e1603b9 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv7m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs
index c562f57252e59..9b4d13a96c8ff 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs
@@ -8,7 +8,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
// See https://developer.android.com/ndk/guides/abis.html#v7a
// for target ABI requirements.
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::android::opts();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-march=armv7-a"]);
Target {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs
index b5e91d61308be..b85b9b60b4209 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs
@@ -6,7 +6,7 @@ use crate::spec::{base, Target, TargetOptions};
// registers enabled as well. See section A2.6.2 on page A2-56 in
// https://web.archive.org/web/20210307234416/https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
index 71d5eb43c1040..f53f21d721772 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
@@ -6,7 +6,7 @@ use crate::spec::{base, Target, TargetOptions};
// registers enabled as well. See section A2.6.2 on page A2-56 in
// https://web.archive.org/web/20210307234416/https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and LLVM
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs
index e18bf113fe7c9..e392240a3335b 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.base-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs
index 44c6fb0dd1bfa..903b8f029114b 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs
@@ -2,7 +2,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.base-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs
index 5c2f1e093819c..d287321c9f293 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs
@@ -3,7 +3,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.main-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs
index 799ac45b479c4..74b143f69956e 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs
@@ -3,7 +3,7 @@
use crate::spec::{base, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.main-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs
index 2f0df7ae857bd..c5de209246c7a 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs
@@ -3,7 +3,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.main-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs
index ee31f17bc4511..44ad78b4684a7 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs
@@ -3,7 +3,7 @@
use crate::spec::{base, cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "thumbv8m.main-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs
index 46257a272d1e1..c22f1589ca137 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs
@@ -2,7 +2,7 @@ use crate::spec::{
base, cvs, LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
// Reset flags for non-Em flavors back to empty to satisfy sanity checking tests.
let pre_link_args = LinkArgs::new();
let post_link_args = TargetOptions::link_args(LinkerFlavor::EmCc, &["-sABORTING_MALLOC=0"]);
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
index bf92f30e8b372..300108530a5b2 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
@@ -12,7 +12,7 @@
use crate::spec::{base, Cc, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut options = base::wasm::options();
options.os = "unknown".into();
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
index 2752125c00991..c317ebd95923d 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
@@ -6,6 +6,6 @@
use crate::spec::Target;
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
super::wasm32_wasip1::target()
}
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 29e6dff2068fc..7728d83c2b680 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -12,7 +12,7 @@
use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut options = base::wasm::options();
options.os = "wasi".into();
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs
index 4e60806f3a736..0ae844c8da8ff 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs
@@ -9,7 +9,7 @@
use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut options = base::wasm::options();
options.os = "wasi".into();
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
index 489bae4fedf17..1d096c6f58900 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
@@ -18,7 +18,7 @@
use crate::spec::{base, crt_objects, LinkSelfContainedDefault, RelocModel, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut options = base::wasm::options();
options.os = "wasi".into();
diff --git a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs
index bc49a3c9f70d0..35c553744763f 100644
--- a/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs
@@ -9,7 +9,7 @@
use crate::spec::{base, Cc, LinkerFlavor, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut options = base::wasm::options();
options.os = "unknown".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
index c3a52a506bc9d..7bf18026735dd 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64;
let mut base = opts("macos", arch, TargetAbi::Normal);
base.max_atomic_width = Some(128); // penryn+ supports cmpxchg16b
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
index 3cabca0336098..76a0bb1d91eef 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{ios_sim_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64;
// x86_64-apple-ios is a simulator target, even though it isn't declared
// that way in the target name like the other ones...
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
index c23a20ff0848e..f66efbbf709d1 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{mac_catalyst_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64;
let mut base = opts("ios", arch, TargetAbi::MacCatalyst);
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::THREAD;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
index 2a3125157dd9d..f9d5f6e77d9fc 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, tvos_sim_llvm_target, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64;
// x86_64-apple-tvos is a simulator target, even though it isn't declared
// that way in the target name like the other ones...
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
index 62e60b5e32d04..1fced10c895ea 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{opts, watchos_sim_llvm_target, Arch, TargetAbi};
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64;
Target {
llvm_target: watchos_sim_llvm_target(arch).into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs
index 5a72fad826323..a3d18e5ecdaf0 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs
@@ -2,7 +2,7 @@ use std::borrow::Cow;
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let pre_link_args = TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::No, Lld::No),
&[
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs
index 46df00e9c02b7..ce3e1e159b7d7 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_fuchsia.rs
@@ -1 +1 @@
-pub use crate::spec::targets::x86_64_unknown_fuchsia::target;
+pub(crate) use crate::spec::targets::x86_64_unknown_fuchsia::target;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
index 257093b75545d..84a747e1feb29 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs
@@ -2,7 +2,7 @@ use crate::spec::{
base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::android::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs
index f6d22ff320494..45963565b06d2 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "x86_64-pc-unknown".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
index 697daf590ad01..37cc7708d6310 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::solaris::opts();
base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64"]);
base.cpu = "x86-64".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs
index 89a9bb1e1cc53..8efebfd42bba7 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_gnu::opts();
base.cpu = "x86-64".into();
base.features = "+cx16,+sse3,+sahf".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs
index acf0fd421bac9..056b0451bbebd 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_gnullvm::opts();
base.cpu = "x86-64".into();
base.features = "+cx16,+sse3,+sahf".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs
index 3ef3e5114e682..d1881caa27321 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.cpu = "x86-64".into();
base.features = "+cx16,+sse3,+sahf".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
index 883da26d786e1..43fac44e48b1f 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "x86_64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
index 171a6f2a51e7c..7ad0dc69e7bd1 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::dragonfly::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
index 4692b5a3c74ef..91cc6669f72c5 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::freebsd::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
index 5ebf1804302b7..836d41a096350 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::fuchsia::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
index b593b79e7bbd4..7aab43b520aba 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::haiku::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
index 3e81ff9a4ec4e..6bc3ec5428648 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, StackProbeType, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "x86_64-unknown-hermit".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs
index d683a44202740..780fd6eb619e3 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::illumos::opts();
base.add_pre_link_args(LinkerFlavor::Unix(Cc::Yes), &["-m64", "-std=c99"]);
base.cpu = "x86-64".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs
index adf489ad7b1dd..f67e9f3b3f11c 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, PanicStrategy, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::l4re::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
index 4a92d4ef9d5ca..80f49d3a64529 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
index 3c7db0095a148..dce23e2ebee0d 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.cpu = "x86-64".into();
base.abi = "x32".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
index 109fc3c0728d8..0262c8fd34fdd 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_musl::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs
index b6e331bd85453..47ff0460d7bde 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux::opts();
base.cpu = "x86-64".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
index c1d888899fc21..28982bc13577d 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::linux_ohos::opts();
base.cpu = "x86-64".into();
base.max_atomic_width = Some(64);
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
index d413caf4aaf77..1ec07fe5a825e 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs
@@ -2,7 +2,7 @@ use crate::spec::{
base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::netbsd::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 175a53f237da1..cfefb1de99387 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -9,7 +9,7 @@ use crate::spec::{
Target, TargetOptions,
};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let opts = TargetOptions {
cpu: "x86-64".into(),
plt_by_default: false,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
index 8f1c3ef9bc7bb..580d0ef85309c 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::openbsd::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
index ae38f63f034f7..5694395151899 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::redox::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
index 2933da92fcc31..f5ab3afffc32c 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
@@ -8,7 +8,7 @@
use crate::abi::call::Conv;
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::uefi_msvc::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs
index c71bc9ed92317..69c70c96d2b54 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_uwp_gnu::opts();
base.cpu = "x86-64".into();
base.features = "+cx16,+sse3,+sahf".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs
index 178baeca68574..74493f0941f20 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_uwp_msvc::opts();
base.cpu = "x86-64".into();
base.features = "+cx16,+sse3,+sahf".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs
index d44ae9fc4e0a1..815016e0adea5 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
index 7b40f7366d0f3..604f71ffaa616 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs
@@ -1,6 +1,6 @@
use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let mut base = base::vxworks::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
index a932d4a3cb466..9b9ffe4e5360e 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs
@@ -1,7 +1,7 @@
use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi};
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
let arch = Arch::X86_64h;
let mut base = opts("macos", arch, TargetAbi::Normal);
base.max_atomic_width = Some(128);
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs
index f041e791a9b0f..804659d3c5281 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs
@@ -2,7 +2,7 @@ use crate::abi::Endian;
use crate::spec::base::xtensa;
use crate::spec::{cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs
index 05666bd81aa13..51960dbec4af4 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs
@@ -1,7 +1,7 @@
use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs
index 83ef520551f55..6c15a82e95cd7 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs
@@ -2,7 +2,7 @@ use crate::abi::Endian;
use crate::spec::base::xtensa;
use crate::spec::{cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs
index aa125eb1ba689..21330615a874d 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs
@@ -1,7 +1,7 @@
use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs
index e18acfccf5ff2..536bd6dc1b2d9 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs
@@ -2,7 +2,7 @@ use crate::abi::Endian;
use crate::spec::base::xtensa;
use crate::spec::{cvs, Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs
index ecbb51dfb665d..fca47b4bdb121 100644
--- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs
+++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs
@@ -1,7 +1,7 @@
use crate::spec::base::xtensa;
use crate::spec::{Target, TargetOptions};
-pub fn target() -> Target {
+pub(crate) fn target() -> Target {
Target {
llvm_target: "xtensa-none-elf".into(),
pointer_width: 32,
diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs
index c98d6c5f1dfd2..b9e629587c1ea 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
#[macro_use]
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index 2d843d8f17406..09c6dcf4f4c05 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -53,7 +53,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 eb01151baae10..364fbd2362018 100644
--- a/compiler/rustc_trait_selection/src/traits/object_safety.rs
+++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs
@@ -28,8 +28,8 @@ use smallvec::SmallVec;
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.
///
@@ -511,7 +511,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;
}
@@ -905,7 +905,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>>,
@@ -929,7 +929,7 @@ pub fn contains_illegal_impl_trait_in_trait<'tcx>(
})
}
-pub fn provide(providers: &mut Providers) {
+pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers {
object_safety_violations,
is_object_safe,
diff --git a/compiler/rustc_trait_selection/src/traits/select/_match.rs b/compiler/rustc_trait_selection/src/traits/select/_match.rs
index 7ead65721f9bb..f77f83ed4471c 100644
--- a/compiler/rustc_trait_selection/src/traits/select/_match.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/_match.rs
@@ -21,12 +21,12 @@ use tracing::instrument;
/// Like subtyping, matching is really a binary relation, so the only
/// important thing about the result is Ok/Err. Also, matching never
/// affects any type variables or unification state.
-pub struct MatchAgainstFreshVars<'tcx> {
+pub(crate) struct MatchAgainstFreshVars<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl<'tcx> MatchAgainstFreshVars<'tcx> {
- pub fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstFreshVars<'tcx> {
+ pub(crate) fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstFreshVars<'tcx> {
MatchAgainstFreshVars { tcx }
}
}
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index f002fa27db27f..19535beb69687 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -3126,7 +3126,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 279f13896f48f..3b34a5d94abdc 100644
--- a/compiler/rustc_trait_selection/src/traits/util.rs
+++ b/compiler/rustc_trait_selection/src/traits/util.rs
@@ -168,7 +168,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,
@@ -208,7 +208,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>,
@@ -237,7 +237,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>,
@@ -248,7 +248,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>,
@@ -259,7 +259,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>,
@@ -270,7 +270,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>,
@@ -286,7 +286,7 @@ pub fn impl_item_is_final(tcx: TyCtxt<'_>, assoc_item: &ty::AssocItem) -> bool {
&& tcx.defaultness(assoc_item.container_id(tcx)).is_final()
}
-pub enum TupleArgumentsFlag {
+pub(crate) enum TupleArgumentsFlag {
Yes,
No,
}
diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs
index ada2c8e81de5b..1118219824652 100644
--- a/compiler/rustc_traits/src/codegen.rs
+++ b/compiler/rustc_traits/src/codegen.rs
@@ -21,7 +21,7 @@ use tracing::debug;
/// obligations *could be* resolved if we wanted to.
///
/// This also expects that `trait_ref` is fully normalized.
-pub fn codegen_select_candidate<'tcx>(
+pub(crate) fn codegen_select_candidate<'tcx>(
tcx: TyCtxt<'tcx>,
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::TraitRef<'tcx>),
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
diff --git a/compiler/rustc_traits/src/lib.rs b/compiler/rustc_traits/src/lib.rs
index 697c839180312..d2f979bd6d9dc 100644
--- a/compiler/rustc_traits/src/lib.rs
+++ b/compiler/rustc_traits/src/lib.rs
@@ -2,6 +2,7 @@
// tidy-alphabetical-start
#![recursion_limit = "256"]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod codegen;
diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs
index 2c67e7d4847ac..c3fd771b79734 100644
--- a/compiler/rustc_transmute/src/layout/tree.rs
+++ b/compiler/rustc_transmute/src/layout/tree.rs
@@ -204,7 +204,7 @@ pub(crate) mod rustc {
}
impl<'tcx> Tree, Ref<'tcx>> {
- pub fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result {
+ pub(crate) fn from_ty(ty: Ty<'tcx>, cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result {
use rustc_target::abi::HasDataLayout;
let layout = layout_of(cx, ty)?;
diff --git a/compiler/rustc_transmute/src/layout/tree/tests.rs b/compiler/rustc_transmute/src/layout/tree/tests.rs
index 3cb47517c2195..44f50a25c939a 100644
--- a/compiler/rustc_transmute/src/layout/tree/tests.rs
+++ b/compiler/rustc_transmute/src/layout/tree/tests.rs
@@ -1,7 +1,7 @@
use super::Tree;
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]
-pub enum Def {
+enum Def {
NoSafetyInvariants,
HasSafetyInvariants,
}
diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs
index bdc98bcea5eb0..c1d0b704ab287 100644
--- a/compiler/rustc_transmute/src/lib.rs
+++ b/compiler/rustc_transmute/src/lib.rs
@@ -2,6 +2,7 @@
#![allow(unused_variables)]
#![feature(alloc_layout_extra)]
#![feature(never_type)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set};
diff --git a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
index 2762b4e638405..b3e1bb31e58e0 100644
--- a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
+++ b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
@@ -366,13 +366,13 @@ where
}
}
-pub enum Quantifier {
+enum Quantifier {
ThereExists,
ForAll,
}
impl Quantifier {
- pub fn apply(&self, iter: I) -> Answer
+ fn apply(&self, iter: I) -> Answer
where
R: layout::Ref,
I: IntoIterator- >,
diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/errors.rs
index 42ecaaeafa905..5497d7d0bd2a0 100644
--- a/compiler/rustc_ty_utils/src/errors.rs
+++ b/compiler/rustc_ty_utils/src/errors.rs
@@ -7,14 +7,14 @@ use rustc_span::Span;
#[derive(Diagnostic)]
#[diag(ty_utils_needs_drop_overflow)]
-pub struct NeedsDropOverflow<'tcx> {
+pub(crate) struct NeedsDropOverflow<'tcx> {
pub query_ty: Ty<'tcx>,
}
#[derive(Diagnostic)]
#[diag(ty_utils_generic_constant_too_complex)]
#[help]
-pub struct GenericConstantTooComplex {
+pub(crate) struct GenericConstantTooComplex {
#[primary_span]
pub span: Span,
#[note(ty_utils_maybe_supported)]
@@ -24,7 +24,7 @@ pub struct GenericConstantTooComplex {
}
#[derive(Subdiagnostic)]
-pub enum GenericConstantTooComplexSub {
+pub(crate) enum GenericConstantTooComplexSub {
#[label(ty_utils_borrow_not_supported)]
BorrowNotSupported(#[primary_span] Span),
#[label(ty_utils_address_and_deref_not_supported)]
@@ -71,40 +71,40 @@ pub enum GenericConstantTooComplexSub {
#[derive(Diagnostic)]
#[diag(ty_utils_unexpected_fnptr_associated_item)]
-pub struct UnexpectedFnPtrAssociatedItem {
+pub(crate) struct UnexpectedFnPtrAssociatedItem {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(ty_utils_zero_length_simd_type)]
-pub struct ZeroLengthSimdType<'tcx> {
+pub(crate) struct ZeroLengthSimdType<'tcx> {
pub ty: Ty<'tcx>,
}
#[derive(Diagnostic)]
#[diag(ty_utils_multiple_array_fields_simd_type)]
-pub struct MultipleArrayFieldsSimdType<'tcx> {
+pub(crate) struct MultipleArrayFieldsSimdType<'tcx> {
pub ty: Ty<'tcx>,
}
#[derive(Diagnostic)]
#[diag(ty_utils_oversized_simd_type)]
-pub struct OversizedSimdType<'tcx> {
+pub(crate) struct OversizedSimdType<'tcx> {
pub ty: Ty<'tcx>,
pub max_lanes: u64,
}
#[derive(Diagnostic)]
#[diag(ty_utils_non_primitive_simd_type)]
-pub struct NonPrimitiveSimdType<'tcx> {
+pub(crate) struct NonPrimitiveSimdType<'tcx> {
pub ty: Ty<'tcx>,
pub e_ty: Ty<'tcx>,
}
#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_duplicate_arg)]
-pub struct DuplicateArg<'tcx> {
+pub(crate) struct DuplicateArg<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
@@ -115,7 +115,7 @@ pub struct DuplicateArg<'tcx> {
#[derive(Diagnostic)]
#[diag(ty_utils_impl_trait_not_param, code = E0792)]
-pub struct NotParam<'tcx> {
+pub(crate) struct NotParam<'tcx> {
pub arg: GenericArg<'tcx>,
#[primary_span]
#[label]
diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs
index ad0bcbfbbc2ac..dc5303317a8a0 100644
--- a/compiler/rustc_ty_utils/src/lib.rs
+++ b/compiler/rustc_ty_utils/src/lib.rs
@@ -16,6 +16,7 @@
#![feature(let_chains)]
#![feature(never_type)]
#![feature(rustdoc_internals)]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
use rustc_middle::query::Providers;
diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs
index 8e3534b0e9eb4..f49aa3431b5c0 100644
--- a/compiler/rustc_type_ir/src/fold.rs
+++ b/compiler/rustc_type_ir/src/fold.rs
@@ -354,7 +354,7 @@ struct Shifter {
}
impl Shifter {
- pub fn new(cx: I, amount: u32) -> Self {
+ fn new(cx: I, amount: u32) -> Self {
Shifter { cx, current_index: ty::INNERMOST, amount }
}
}
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index de41d2f3cc512..39ab2e376137e 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -5,6 +5,7 @@
feature(associated_type_defaults, never_type, rustc_attrs, negative_impls)
)]
#![cfg_attr(feature = "nightly", allow(internal_features))]
+#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate self as rustc_type_ir;
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs
index e602b497d171a..fed484ae3cd12 100644
--- a/library/core/src/mem/mod.rs
+++ b/library/core/src/mem/mod.rs
@@ -612,7 +612,7 @@ pub const fn needs_drop() -> bool {
///
/// There is no guarantee that an all-zero byte-pattern represents a valid value
/// of some type `T`. For example, the all-zero byte-pattern is not a valid value
-/// for reference types (`&T`, `&mut T`) and functions pointers. Using `zeroed`
+/// for reference types (`&T`, `&mut T`) and function pointers. Using `zeroed`
/// on such types causes immediate [undefined behavior][ub] because [the Rust
/// compiler assumes][inv] that there always is a valid value in a variable it
/// considers initialized.
diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs
index c1e0e5c1c8975..dd85239fa8cfd 100644
--- a/library/profiler_builtins/build.rs
+++ b/library/profiler_builtins/build.rs
@@ -1,14 +1,15 @@
//! Compiles the profiler part of the `compiler-rt` library.
//!
-//! See the build.rs for libcompiler_builtins crate for details.
+//! Loosely based on:
+//! - LLVM's `compiler-rt/lib/profile/CMakeLists.txt`
+//! - .
use std::env;
use std::path::PathBuf;
fn main() {
- println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB");
- if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") {
- println!("cargo:rustc-link-lib=static:+verbatim={rt}");
+ if let Ok(rt) = tracked_env_var("LLVM_PROFILER_RT_LIB") {
+ println!("cargo::rustc-link-lib=static:+verbatim={rt}");
return;
}
@@ -16,13 +17,13 @@ fn main() {
let target_env = env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV was not set");
let cfg = &mut cc::Build::new();
- // FIXME: `rerun-if-changed` directives are not currently emitted and the build script
- // will not rerun on changes in these source files or headers included into them.
- let mut profile_sources = vec![
+ let profile_sources = vec![
+ // tidy-alphabetical-start
"GCDAProfiling.c",
"InstrProfiling.c",
"InstrProfilingBuffer.c",
"InstrProfilingFile.c",
+ "InstrProfilingInternal.c",
"InstrProfilingMerge.c",
"InstrProfilingMergeFile.c",
"InstrProfilingNameVar.c",
@@ -37,15 +38,13 @@ fn main() {
"InstrProfilingValue.c",
"InstrProfilingVersionVar.c",
"InstrProfilingWriter.c",
- // These files were added in LLVM 11.
- "InstrProfilingInternal.c",
- "InstrProfilingBiasVar.c",
+ "WindowsMMap.c",
+ // tidy-alphabetical-end
];
if target_env == "msvc" {
// Don't pull in extra libraries on MSVC
cfg.flag("/Zl");
- profile_sources.push("WindowsMMap.c");
cfg.define("strdup", Some("_strdup"));
cfg.define("open", Some("_open"));
cfg.define("fdopen", Some("_fdopen"));
@@ -60,8 +59,6 @@ fn main() {
if target_os != "windows" {
cfg.flag("-fvisibility=hidden");
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
- } else {
- profile_sources.push("WindowsMMap.c");
}
}
@@ -80,26 +77,33 @@ fn main() {
}
// Get the LLVM `compiler-rt` directory from bootstrap.
- println!("cargo:rerun-if-env-changed=RUST_COMPILER_RT_FOR_PROFILER");
- let root = PathBuf::from(env::var("RUST_COMPILER_RT_FOR_PROFILER").unwrap_or_else(|_| {
- let path = "../../src/llvm-project/compiler-rt";
- println!("RUST_COMPILER_RT_FOR_PROFILER was not set; falling back to {path:?}");
- path.to_owned()
- }));
+ let root = PathBuf::from(tracked_env_var_or_fallback(
+ "RUST_COMPILER_RT_FOR_PROFILER",
+ "../../src/llvm-project/compiler-rt",
+ ));
let src_root = root.join("lib").join("profile");
assert!(src_root.exists(), "profiler runtime source directory not found: {src_root:?}");
- let mut n_sources_found = 0u32;
- for src in profile_sources {
- let path = src_root.join(src);
- if path.exists() {
- cfg.file(path);
- n_sources_found += 1;
- }
+ println!("cargo::rerun-if-changed={}", src_root.display());
+ for file in profile_sources {
+ cfg.file(src_root.join(file));
}
- assert!(n_sources_found > 0, "couldn't find any profiler runtime source files in {src_root:?}");
- cfg.include(root.join("include"));
+ let include = root.join("include");
+ println!("cargo::rerun-if-changed={}", include.display());
+ cfg.include(include);
+
cfg.warnings(false);
cfg.compile("profiler-rt");
}
+
+fn tracked_env_var(key: &str) -> Result {
+ println!("cargo::rerun-if-env-changed={key}");
+ env::var(key)
+}
+fn tracked_env_var_or_fallback(key: &str, fallback: &str) -> String {
+ tracked_env_var(key).unwrap_or_else(|_| {
+ println!("cargo::warning={key} was not set; falling back to {fallback:?}");
+ fallback.to_owned()
+ })
+}
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index c42d4c56c3816..60ec57d0d443a 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -8,9 +8,7 @@
//! In theory if we get past this phase it's a bug if a build fails, but in
//! practice that's likely not true!
-use std::collections::HashMap;
-#[cfg(not(feature = "bootstrap-self-test"))]
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
use std::{env, fs};
@@ -34,7 +32,6 @@ pub struct Finder {
// it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list.
//
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
-#[cfg(not(feature = "bootstrap-self-test"))]
const STAGE0_MISSING_TARGETS: &[&str] = &[
// just a dummy comment so the list doesn't get onelined
];
@@ -205,7 +202,6 @@ than building it.
.map(|p| cmd_finder.must_have(p))
.or_else(|| cmd_finder.maybe_have("reuse"));
- #[cfg(not(feature = "bootstrap-self-test"))]
let stage0_supported_target_list: HashSet = crate::utils::helpers::output(
command(&build.config.initial_rustc).args(["--print", "target-list"]).as_command_mut(),
)
@@ -234,8 +230,7 @@ than building it.
}
// Ignore fake targets that are only used for unit tests in bootstrap.
- #[cfg(not(feature = "bootstrap-self-test"))]
- {
+ if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity {
let mut has_target = false;
let target_str = target.to_string();
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 75f2a1418cd8f..c3e219f2c87b3 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -1878,9 +1878,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm
if (elem === null) {
return;
}
- const buttons = elem.querySelector(".button-holder");
+ let buttons = elem.querySelector(".button-holder");
if (buttons === null) {
- return;
+ // On mobile, you can't hover an element so buttons need to be created on click
+ // if they're not already there.
+ addCopyButton(event);
+ buttons = elem.querySelector(".button-holder");
+ if (buttons === null) {
+ return;
+ }
}
buttons.classList.toggle("keep-visible");
}
diff --git a/src/tools/miri/src/alloc_addresses/mod.rs b/src/tools/miri/src/alloc_addresses/mod.rs
index ed955e78c3e9a..76c68add8cdc9 100644
--- a/src/tools/miri/src/alloc_addresses/mod.rs
+++ b/src/tools/miri/src/alloc_addresses/mod.rs
@@ -42,6 +42,11 @@ pub struct GlobalStateInner {
/// they do not have an `AllocExtra`.
/// This is the inverse of `int_to_ptr_map`.
base_addr: FxHashMap,
+ /// Temporarily store prepared memory space for global allocations the first time their memory
+ /// address is required. This is used to ensure that the memory is allocated before Miri assigns
+ /// it an internal address, which is important for matching the internal address to the machine
+ /// address so FFI can read from pointers.
+ prepared_alloc_bytes: FxHashMap,
/// A pool of addresses we can reuse for future allocations.
reuse: ReusePool,
/// Whether an allocation has been exposed or not. This cannot be put
@@ -59,6 +64,7 @@ impl VisitProvenance for GlobalStateInner {
let GlobalStateInner {
int_to_ptr_map: _,
base_addr: _,
+ prepared_alloc_bytes: _,
reuse: _,
exposed: _,
next_base_addr: _,
@@ -78,6 +84,7 @@ impl GlobalStateInner {
GlobalStateInner {
int_to_ptr_map: Vec::default(),
base_addr: FxHashMap::default(),
+ prepared_alloc_bytes: FxHashMap::default(),
reuse: ReusePool::new(config),
exposed: FxHashSet::default(),
next_base_addr: stack_addr,
@@ -166,7 +173,39 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
assert!(!matches!(kind, AllocKind::Dead));
// This allocation does not have a base address yet, pick or reuse one.
- let base_addr = if let Some((reuse_addr, clock)) = global_state.reuse.take_addr(
+ let base_addr = if ecx.machine.native_lib.is_some() {
+ // In native lib mode, we use the "real" address of the bytes for this allocation.
+ // This ensures the interpreted program and native code have the same view of memory.
+ match kind {
+ AllocKind::LiveData => {
+ let ptr = if ecx.tcx.try_get_global_alloc(alloc_id).is_some() {
+ // For new global allocations, we always pre-allocate the memory to be able use the machine address directly.
+ let prepared_bytes = MiriAllocBytes::zeroed(size, align)
+ .unwrap_or_else(|| {
+ panic!("Miri ran out of memory: cannot create allocation of {size:?} bytes")
+ });
+ let ptr = prepared_bytes.as_ptr();
+ // Store prepared allocation space to be picked up for use later.
+ global_state.prepared_alloc_bytes.try_insert(alloc_id, prepared_bytes).unwrap();
+ ptr
+ } else {
+ ecx.get_alloc_bytes_unchecked_raw(alloc_id)?
+ };
+ // Ensure this pointer's provenance is exposed, so that it can be used by FFI code.
+ ptr.expose_provenance().try_into().unwrap()
+ }
+ AllocKind::Function | AllocKind::VTable => {
+ // Allocate some dummy memory to get a unique address for this function/vtable.
+ let alloc_bytes = MiriAllocBytes::from_bytes(&[0u8; 1], Align::from_bytes(1).unwrap());
+ // We don't need to expose these bytes as nobody is allowed to access them.
+ let addr = alloc_bytes.as_ptr().addr().try_into().unwrap();
+ // Leak the underlying memory to ensure it remains unique.
+ std::mem::forget(alloc_bytes);
+ addr
+ }
+ AllocKind::Dead => unreachable!()
+ }
+ } else if let Some((reuse_addr, clock)) = global_state.reuse.take_addr(
&mut *rng,
size,
align,
@@ -318,6 +357,33 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
Ok(base_ptr.wrapping_offset(offset, ecx))
}
+ // This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved
+ // memory space in the past, or by doing the pre-allocation right upon being called.
+ fn get_global_alloc_bytes(&self, id: AllocId, kind: MemoryKind, bytes: &[u8], align: Align) -> InterpResult<'tcx, MiriAllocBytes> {
+ let ecx = self.eval_context_ref();
+ Ok(if ecx.machine.native_lib.is_some() {
+ // In native lib mode, MiriAllocBytes for global allocations are handled via `prepared_alloc_bytes`.
+ // This additional call ensures that some `MiriAllocBytes` are always prepared.
+ ecx.addr_from_alloc_id(id, kind)?;
+ let mut global_state = ecx.machine.alloc_addresses.borrow_mut();
+ // The memory we need here will have already been allocated during an earlier call to
+ // `addr_from_alloc_id` for this allocation. So don't create a new `MiriAllocBytes` here, instead
+ // fetch the previously prepared bytes from `prepared_alloc_bytes`.
+ let mut prepared_alloc_bytes = global_state
+ .prepared_alloc_bytes
+ .remove(&id)
+ .unwrap_or_else(|| panic!("alloc bytes for {id:?} have not been prepared"));
+ // Sanity-check that the prepared allocation has the right size and alignment.
+ assert!(prepared_alloc_bytes.as_ptr().is_aligned_to(align.bytes_usize()));
+ assert_eq!(prepared_alloc_bytes.len(), bytes.len());
+ // Copy allocation contents into prepared memory.
+ prepared_alloc_bytes.copy_from_slice(bytes);
+ prepared_alloc_bytes
+ } else {
+ MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(&*bytes), align)
+ })
+ }
+
/// When a pointer is used for a memory access, this computes where in which allocation the
/// access is going.
fn ptr_get_alloc(
diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs
index a4d3e3f7af3ce..37d4a2663e012 100644
--- a/src/tools/miri/src/concurrency/thread.rs
+++ b/src/tools/miri/src/concurrency/thread.rs
@@ -887,7 +887,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let alloc = this.ctfe_query(|tcx| tcx.eval_static_initializer(def_id))?;
// We make a full copy of this allocation.
let mut alloc =
- alloc.inner().adjust_from_tcx(&this.tcx, |ptr| this.global_root_pointer(ptr))?;
+ alloc.inner().adjust_from_tcx(&this.tcx, |bytes, align| Ok(MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(bytes), align)), |ptr| this.global_root_pointer(ptr))?;
// This allocation will be deallocated when the thread dies, so it is not in read-only memory.
alloc.mutability = Mutability::Mut;
// Create a fresh allocation with this content.
diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs
index f796e845a2399..f70ca098fb95b 100644
--- a/src/tools/miri/src/lib.rs
+++ b/src/tools/miri/src/lib.rs
@@ -12,6 +12,9 @@
#![feature(let_chains)]
#![feature(trait_upcasting)]
#![feature(strict_overflow_ops)]
+#![feature(strict_provenance)]
+#![feature(exposed_provenance)]
+#![feature(pointer_is_aligned_to)]
// Configure clippy and other lints
#![allow(
clippy::collapsible_else_if,
diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs
index 264b7b269de72..66c6966d1a6c3 100644
--- a/src/tools/miri/src/machine.rs
+++ b/src/tools/miri/src/machine.rs
@@ -1,6 +1,7 @@
//! Global machine state as well as implementation of the interpreter engine
//! `Machine` trait.
+use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::hash_map::Entry;
use std::fmt;
@@ -1261,6 +1262,30 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
})
}
+ /// Called to adjust global allocations to the Provenance and AllocExtra of this machine.
+ ///
+ /// If `alloc` contains pointers, then they are all pointing to globals.
+ ///
+ /// This should avoid copying if no work has to be done! If this returns an owned
+ /// allocation (because a copy had to be done to adjust things), machine memory will
+ /// cache the result. (This relies on `AllocMap::get_or` being able to add the
+ /// owned allocation to the map even when the map is shared.)
+ fn adjust_global_allocation<'b>(
+ ecx: &InterpCx<'tcx, Self>,
+ id: AllocId,
+ alloc: &'b Allocation,
+ ) -> InterpResult<'tcx, Cow<'b, Allocation>>
+ {
+ let kind = Self::GLOBAL_KIND.unwrap().into();
+ let alloc = alloc.adjust_from_tcx(&ecx.tcx,
+ |bytes, align| ecx.get_global_alloc_bytes(id, kind, bytes, align),
+ |ptr| ecx.global_root_pointer(ptr),
+ )?;
+ let extra =
+ Self::init_alloc_extra(ecx, id, kind, alloc.size(), alloc.align)?;
+ Ok(Cow::Owned(alloc.with_extra(extra)))
+ }
+
#[inline(always)]
fn before_memory_read(
_tcx: TyCtxtAt<'tcx>,
diff --git a/src/tools/miri/src/shims/native_lib.rs b/src/tools/miri/src/shims/native_lib.rs
index 40697e17ba193..25d96fbd7331f 100644
--- a/src/tools/miri/src/shims/native_lib.rs
+++ b/src/tools/miri/src/shims/native_lib.rs
@@ -194,6 +194,8 @@ enum CArg {
UInt64(u64),
/// usize.
USize(usize),
+ /// Raw pointer, stored as C's `void*`.
+ RawPtr(*mut std::ffi::c_void),
}
impl<'a> CArg {
@@ -210,6 +212,7 @@ impl<'a> CArg {
CArg::UInt32(i) => ffi::arg(i),
CArg::UInt64(i) => ffi::arg(i),
CArg::USize(i) => ffi::arg(i),
+ CArg::RawPtr(i) => ffi::arg(i),
}
}
}
@@ -234,6 +237,16 @@ fn imm_to_carg<'tcx>(v: ImmTy<'tcx>, cx: &impl HasDataLayout) -> InterpResult<'t
ty::Uint(UintTy::U64) => CArg::UInt64(v.to_scalar().to_u64()?),
ty::Uint(UintTy::Usize) =>
CArg::USize(v.to_scalar().to_target_usize(cx)?.try_into().unwrap()),
+ ty::RawPtr(_, mutability) => {
+ // Arbitrary mutable pointer accesses are not currently supported in Miri.
+ if mutability.is_mut() {
+ throw_unsup_format!("unsupported mutable pointer type for native call: {}", v.layout.ty);
+ } else {
+ let s = v.to_scalar().to_pointer(cx)?.addr();
+ // This relies on the `expose_provenance` in `addr_from_alloc_id`.
+ CArg::RawPtr(std::ptr::with_exposed_provenance_mut(s.bytes_usize()))
+ }
+ },
_ => throw_unsup_format!("unsupported argument type for native call: {}", v.layout.ty),
})
}
diff --git a/src/tools/miri/tests/native-lib/libtest.map b/src/tools/miri/tests/native-lib/native-lib.map
similarity index 62%
rename from src/tools/miri/tests/native-lib/libtest.map
rename to src/tools/miri/tests/native-lib/native-lib.map
index a57a4dc149feb..7e3bd19622af3 100644
--- a/src/tools/miri/tests/native-lib/libtest.map
+++ b/src/tools/miri/tests/native-lib/native-lib.map
@@ -1,12 +1,20 @@
CODEABI_1.0 {
# Define which symbols to export.
global:
+ # scalar_arguments.c
add_one_int;
printer;
test_stack_spill;
get_unsigned_int;
add_int16;
add_short_to_long;
+
+ # ptr_read_access.c
+ print_pointer;
+ access_simple;
+ access_nested;
+ access_static;
+
# The rest remains private.
local: *;
};
diff --git a/src/tools/miri/tests/native-lib/pass/ptr_read_access.rs b/src/tools/miri/tests/native-lib/pass/ptr_read_access.rs
new file mode 100644
index 0000000000000..d8e6209839e2a
--- /dev/null
+++ b/src/tools/miri/tests/native-lib/pass/ptr_read_access.rs
@@ -0,0 +1,82 @@
+//@only-target-linux
+//@only-on-host
+
+fn main() {
+ test_pointer();
+
+ test_simple();
+
+ test_nested();
+
+ test_static();
+}
+
+// Test void function that dereferences a pointer and prints its contents from C.
+fn test_pointer() {
+ extern "C" {
+ fn print_pointer(ptr: *const i32);
+ }
+
+ let x = 42;
+
+ unsafe { print_pointer(&x) };
+}
+
+// Test function that dereferences a simple struct pointer and accesses a field.
+fn test_simple() {
+ #[repr(C)]
+ struct Simple {
+ field: i32
+ }
+
+ extern "C" {
+ fn access_simple(s_ptr: *const Simple) -> i32;
+ }
+
+ let simple = Simple { field: -42 };
+
+ assert_eq!(unsafe { access_simple(&simple) }, -42);
+}
+
+// Test function that dereferences nested struct pointers and accesses fields.
+fn test_nested() {
+ use std::ptr::NonNull;
+
+ #[derive(Debug, PartialEq, Eq)]
+ #[repr(C)]
+ struct Nested {
+ value: i32,
+ next: Option>,
+ }
+
+ extern "C" {
+ fn access_nested(n_ptr: *const Nested) -> i32;
+ }
+
+ let mut nested_0 = Nested { value: 97, next: None };
+ let mut nested_1 = Nested { value: 98, next: NonNull::new(&mut nested_0) };
+ let nested_2 = Nested { value: 99, next: NonNull::new(&mut nested_1) };
+
+ assert_eq!(unsafe { access_nested(&nested_2) }, 97);
+}
+
+// Test function that dereferences static struct pointers and accesses fields.
+fn test_static() {
+
+ #[repr(C)]
+ struct Static {
+ value: i32,
+ recurse: &'static Static,
+ }
+
+ extern "C" {
+ fn access_static(n_ptr: *const Static) -> i32;
+ }
+
+ static STATIC: Static = Static {
+ value: 9001,
+ recurse: &STATIC,
+ };
+
+ assert_eq!(unsafe { access_static(&STATIC) }, 9001);
+}
diff --git a/src/tools/miri/tests/native-lib/pass/ptr_read_access.stdout b/src/tools/miri/tests/native-lib/pass/ptr_read_access.stdout
new file mode 100644
index 0000000000000..1a8799abfc93e
--- /dev/null
+++ b/src/tools/miri/tests/native-lib/pass/ptr_read_access.stdout
@@ -0,0 +1 @@
+printing pointer dereference from C: 42
diff --git a/src/tools/miri/tests/native-lib/pass/call_extern_c_fn.rs b/src/tools/miri/tests/native-lib/pass/scalar_arguments.rs
similarity index 100%
rename from src/tools/miri/tests/native-lib/pass/call_extern_c_fn.rs
rename to src/tools/miri/tests/native-lib/pass/scalar_arguments.rs
diff --git a/src/tools/miri/tests/native-lib/pass/call_extern_c_fn.stdout b/src/tools/miri/tests/native-lib/pass/scalar_arguments.stdout
similarity index 100%
rename from src/tools/miri/tests/native-lib/pass/call_extern_c_fn.stdout
rename to src/tools/miri/tests/native-lib/pass/scalar_arguments.stdout
diff --git a/src/tools/miri/tests/native-lib/ptr_read_access.c b/src/tools/miri/tests/native-lib/ptr_read_access.c
new file mode 100644
index 0000000000000..03b9189e2e86d
--- /dev/null
+++ b/src/tools/miri/tests/native-lib/ptr_read_access.c
@@ -0,0 +1,47 @@
+#include
+
+/* Test: test_pointer */
+
+void print_pointer(const int *ptr) {
+ printf("printing pointer dereference from C: %d\n", *ptr);
+}
+
+/* Test: test_simple */
+
+typedef struct Simple {
+ int field;
+} Simple;
+
+int access_simple(const Simple *s_ptr) {
+ return s_ptr->field;
+}
+
+/* Test: test_nested */
+
+typedef struct Nested {
+ int value;
+ struct Nested *next;
+} Nested;
+
+// Returns the innermost/last value of a Nested pointer chain.
+int access_nested(const Nested *n_ptr) {
+ // Edge case: `n_ptr == NULL` (i.e. first Nested is None).
+ if (!n_ptr) { return 0; }
+
+ while (n_ptr->next) {
+ n_ptr = n_ptr->next;
+ }
+
+ return n_ptr->value;
+}
+
+/* Test: test_static */
+
+typedef struct Static {
+ int value;
+ struct Static *recurse;
+} Static;
+
+int access_static(const Static *s_ptr) {
+ return s_ptr->recurse->recurse->value;
+}
diff --git a/src/tools/miri/tests/native-lib/test.c b/src/tools/miri/tests/native-lib/scalar_arguments.c
similarity index 100%
rename from src/tools/miri/tests/native-lib/test.c
rename to src/tools/miri/tests/native-lib/scalar_arguments.c
diff --git a/src/tools/miri/tests/ui.rs b/src/tools/miri/tests/ui.rs
index 9cbcf6e42a795..c510ef95c30e8 100644
--- a/src/tools/miri/tests/ui.rs
+++ b/src/tools/miri/tests/ui.rs
@@ -36,18 +36,25 @@ fn build_native_lib() -> PathBuf {
// Create the directory if it does not already exist.
std::fs::create_dir_all(&so_target_dir)
.expect("Failed to create directory for shared object file");
- let so_file_path = so_target_dir.join("libtestlib.so");
+ let so_file_path = so_target_dir.join("native-lib.so");
let cc_output = Command::new(cc)
.args([
"-shared",
"-o",
so_file_path.to_str().unwrap(),
- "tests/native-lib/test.c",
+ // FIXME: Automate gathering of all relevant C source files in the directory.
+ "tests/native-lib/scalar_arguments.c",
+ "tests/native-lib/ptr_read_access.c",
// Only add the functions specified in libcode.version to the shared object file.
// This is to avoid automatically adding `malloc`, etc.
// Source: https://anadoxin.org/blog/control-over-symbol-exports-in-gcc.html/
"-fPIC",
- "-Wl,--version-script=tests/native-lib/libtest.map",
+ "-Wl,--version-script=tests/native-lib/native-lib.map",
+ // Ensure we notice serious problems in the C code.
+ "-Wall",
+ "-Wextra",
+ "-Wpedantic",
+ "-Werror",
])
.output()
.expect("failed to generate shared object file for testing native function calls");
diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs
index 30c9648bc08e9..9dbba7a05001d 100644
--- a/src/tools/opt-dist/src/tests.rs
+++ b/src/tools/opt-dist/src/tests.rs
@@ -102,7 +102,13 @@ llvm-config = "{llvm_config}"
for test_path in env.skipped_tests() {
args.extend(["--skip", test_path]);
}
- cmd(&args).env("COMPILETEST_FORCE_STAGE0", "1").run().context("Cannot execute tests")
+ cmd(&args)
+ .env("COMPILETEST_FORCE_STAGE0", "1")
+ // Above we override the stage 0 compiler with previously compiled compiler,
+ // which can cause confusion in bootstrap's target sanity checks.
+ .env("BOOTSTRAP_SKIP_TARGET_SANITY", "1")
+ .run()
+ .context("Cannot execute tests")
}
/// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z).
diff --git a/src/tools/run-make-support/Cargo.toml b/src/tools/run-make-support/Cargo.toml
index 77df6e7beb591..d3605cd3dce05 100644
--- a/src/tools/run-make-support/Cargo.toml
+++ b/src/tools/run-make-support/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
bstr = "1.6.0"
object = "0.36.2"
similar = "2.5.0"
-wasmparser = { version = "0.215", default-features = false, features = ["std"] }
+wasmparser = { version = "0.216", default-features = false, features = ["std"] }
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
gimli = "0.31.0"
build_helper = { path = "../build_helper" }
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index a4d27d29d3269..4f24eb2124207 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -455,9 +455,10 @@ fn get_and_check_lib_features(
if f.tracking_issue != s.tracking_issue && f.level != Status::Accepted {
tidy_error!(
bad,
- "{}:{}: `issue` \"{}\" mismatches the {} `issue` of \"{}\"",
+ "{}:{}: feature gate {} has inconsistent `issue`: \"{}\" mismatches the {} `issue` of \"{}\"",
file.display(),
line,
+ name,
f.tracking_issue_display(),
display,
s.tracking_issue_display(),
diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs
index 8be27d1e117ce..c1032b19f9709 100644
--- a/src/tools/tidy/src/target_specific_tests.rs
+++ b/src/tools/tidy/src/target_specific_tests.rs
@@ -36,8 +36,8 @@ struct RevisionInfo<'a> {
llvm_components: Option>,
}
-pub fn check(path: &Path, bad: &mut bool) {
- crate::walk::walk(path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| {
+pub fn check(tests_path: &Path, bad: &mut bool) {
+ crate::walk::walk(tests_path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| {
let file = entry.path().display();
let mut header_map = BTreeMap::new();
iter_header(content, &mut |HeaderLine { revision, directive, .. }| {
@@ -65,6 +65,12 @@ pub fn check(path: &Path, bad: &mut bool) {
}
}
});
+
+ // Skip run-make tests as revisions are not supported.
+ if entry.path().strip_prefix(tests_path).is_ok_and(|rest| rest.starts_with("run-make")) {
+ return;
+ }
+
for (rev, RevisionInfo { target_arch, llvm_components }) in &header_map {
let rev = rev.unwrap_or("[unspecified]");
match (target_arch, llvm_components) {
diff --git a/tests/crashes/129425.rs b/tests/crashes/129425.rs
new file mode 100644
index 0000000000000..ac7dc0078474d
--- /dev/null
+++ b/tests/crashes/129425.rs
@@ -0,0 +1,6 @@
+//@ known-bug: rust-lang/rust#129425
+
+//@compile-flags: --crate-type=lib
+
+#![feature(generic_const_exprs)]
+fn foo<'a, T: 'a>(_: [(); std::mem::offset_of!((T,), 0)]) {}
diff --git a/tests/crashes/129444.rs b/tests/crashes/129444.rs
new file mode 100644
index 0000000000000..b1b547b5191bd
--- /dev/null
+++ b/tests/crashes/129444.rs
@@ -0,0 +1,15 @@
+//@ known-bug: rust-lang/rust#129444
+
+//@ compile-flags: -Znext-solver=coherence
+
+trait Trait {
+ type Assoc;
+}
+
+struct W(*mut T);
+impl Trait for W>> {}
+
+trait NoOverlap {}
+impl>> NoOverlap for T {}
+
+impl> NoOverlap for W {}
diff --git a/tests/crashes/129503.rs b/tests/crashes/129503.rs
new file mode 100644
index 0000000000000..c1ed46e595570
--- /dev/null
+++ b/tests/crashes/129503.rs
@@ -0,0 +1,7 @@
+//@ known-bug: rust-lang/rust#129503
+
+use std::arch::asm;
+
+unsafe fn f6() {
+ asm!(concat!(r#"lJ�.�"#, "r} {}"));
+}
diff --git a/tests/crashes/129556.rs b/tests/crashes/129556.rs
new file mode 100644
index 0000000000000..364827e9444f6
--- /dev/null
+++ b/tests/crashes/129556.rs
@@ -0,0 +1,26 @@
+//@ known-bug: rust-lang/rust#129556
+
+#![feature(adt_const_params)]
+#![feature(generic_const_exprs)]
+
+use core::marker::ConstParamTy;
+
+// #[derive(ConstParamTy, PartialEq, Eq)]
+// struct StructOrEnum;
+
+#[derive(ConstParamTy, PartialEq, Eq)]
+enum StructOrEnum {
+ A,
+}
+
+trait TraitParent {}
+
+trait TraitChild: TraitParent {}
+
+impl TraitParent for StructOrEnum {}
+
+// ICE occurs
+impl TraitChild for StructOrEnum {}
+
+// ICE does not occur
+// impl TraitChild<{ StructOrEnum::A }> for StructOrEnum {}
diff --git a/tests/run-make/print-cfg/rmake.rs b/tests/run-make/print-cfg/rmake.rs
index 471a99b90d982..7b8b760ea333b 100644
--- a/tests/run-make/print-cfg/rmake.rs
+++ b/tests/run-make/print-cfg/rmake.rs
@@ -5,6 +5,11 @@
//!
//! It also checks that some targets have the correct set cfgs.
+// ignore-tidy-linelength
+//@ needs-llvm-components: arm x86
+// Note: without the needs-llvm-components it will fail on LLVM built without the required
+// components listed above.
+
use std::collections::HashSet;
use std::iter::FromIterator;
use std::path::PathBuf;
diff --git a/tests/run-make/print-target-list/rmake.rs b/tests/run-make/print-target-list/rmake.rs
index 743ed52069dea..04ef8440104f6 100644
--- a/tests/run-make/print-target-list/rmake.rs
+++ b/tests/run-make/print-target-list/rmake.rs
@@ -1,10 +1,15 @@
-// Checks that all the targets returned by `rustc --print target-list` are valid
-// target specifications
+// Checks that all the targets returned by `rustc --print target-list` are valid target
+// specifications.
+
+// ignore-tidy-linelength
+//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86
+// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it
+// will fail on LLVM built without all of the components listed above.
use run_make_support::bare_rustc;
-// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine'
-// in CI, so we skip them
+// FIXME(#127877): certain experimental targets fail with creating a 'LLVM TargetMachine' in CI, so
+// we skip them.
const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"];
fn main() {
diff --git a/tests/run-make/print-to-output/rmake.rs b/tests/run-make/print-to-output/rmake.rs
index db2a291f8e737..a85ab5e23b080 100644
--- a/tests/run-make/print-to-output/rmake.rs
+++ b/tests/run-make/print-to-output/rmake.rs
@@ -1,5 +1,11 @@
-//! This checks the output of some `--print` options when
-//! output to a file (instead of stdout)
+//! This checks the output of some `--print` options when output to a file (instead of stdout)
+
+// ignore-tidy-linelength
+//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86
+// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it
+// will fail on LLVM built without all of the components listed above. If adding a new target that
+// relies on a llvm component not listed above, it will need to be added to the required llvm
+// components above.
use std::path::PathBuf;
diff --git a/tests/run-make/target-without-atomic-cas/rmake.rs b/tests/run-make/target-without-atomic-cas/rmake.rs
index c8782b6d1a566..e6c86c0c21d96 100644
--- a/tests/run-make/target-without-atomic-cas/rmake.rs
+++ b/tests/run-make/target-without-atomic-cas/rmake.rs
@@ -1,8 +1,13 @@
-// ARM Cortex-M are a class of processors supported by the rust compiler. However,
-// they cannot support any atomic features, such as Arc. This test simply prints
-// the configuration details of one Cortex target, and checks that the compiler
-// does not falsely list atomic support.
-// See https://github.com/rust-lang/rust/pull/36874
+// ARM Cortex-M are a class of processors supported by the rust compiler. However, they cannot
+// support any atomic features, such as Arc. This test simply prints the configuration details of
+// one Cortex target, and checks that the compiler does not falsely list atomic support.
+// See .
+
+// ignore-tidy-linelength
+//@ needs-llvm-components: arm
+// Note: without the needs-llvm-components it will fail on LLVM built without all of the components
+// listed above. If any new targets are added, please double-check their respective llvm components
+// are specified above.
use run_make_support::rustc;
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
index 019deda063c78..cb447719f9c58 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
@@ -20,12 +20,12 @@ error: const-stable function cannot use `#[feature(const_refs_to_cell)]`
LL | x.get();
| ^
|
-help: if it is not part of the public API, make this function unstably const
+help: if the function is not (yet) meant to be stable, make this function unstably const
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
LL | const fn bar3() -> u32 {
|
-help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
+help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval)
|
LL + #[rustc_allow_const_fn_unstable(const_refs_to_cell)]
LL | const fn bar3() -> u32 {