From fc4056ec78ca113d5296634cb59c9dd3325c1153 Mon Sep 17 00:00:00 2001 From: nxsaken Date: Sun, 9 Nov 2025 20:21:12 +0400 Subject: [PATCH 01/15] Constify `ManuallyDrop::take` --- library/core/src/mem/manually_drop.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs index 334a4b7119a11..b2328fcf7d844 100644 --- a/library/core/src/mem/manually_drop.rs +++ b/library/core/src/mem/manually_drop.rs @@ -217,8 +217,9 @@ impl ManuallyDrop { /// #[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"] #[stable(feature = "manually_drop_take", since = "1.42.0")] + #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "none")] #[inline] - pub unsafe fn take(slot: &mut ManuallyDrop) -> T { + pub const unsafe fn take(slot: &mut ManuallyDrop) -> T { // SAFETY: we are reading from a reference, which is guaranteed // to be valid for reads. unsafe { ptr::read(&slot.value) } From 264c6d41aaa91f4bf13708b8adfe60913d9e28b3 Mon Sep 17 00:00:00 2001 From: nxsaken Date: Sun, 9 Nov 2025 21:52:04 +0400 Subject: [PATCH 02/15] Constify `mem::take` --- library/core/src/mem/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 619e8a263db40..1a39a9a551603 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -807,7 +807,8 @@ pub const fn swap(x: &mut T, y: &mut T) { /// ``` #[inline] #[stable(feature = "mem_take", since = "1.40.0")] -pub fn take(dest: &mut T) -> T { +#[rustc_const_unstable(feature = "const_default", issue = "143894")] +pub const fn take(dest: &mut T) -> T { replace(dest, T::default()) } From 1d9be661a8e1998616692d780cc617c6ac3fe386 Mon Sep 17 00:00:00 2001 From: nxsaken Date: Mon, 10 Nov 2025 09:38:04 +0400 Subject: [PATCH 03/15] Add tracking issue number --- library/core/src/mem/manually_drop.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/mem/manually_drop.rs b/library/core/src/mem/manually_drop.rs index b2328fcf7d844..7d49da8509577 100644 --- a/library/core/src/mem/manually_drop.rs +++ b/library/core/src/mem/manually_drop.rs @@ -217,7 +217,7 @@ impl ManuallyDrop { /// #[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"] #[stable(feature = "manually_drop_take", since = "1.42.0")] - #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "none")] + #[rustc_const_unstable(feature = "const_manually_drop_take", issue = "148773")] #[inline] pub const unsafe fn take(slot: &mut ManuallyDrop) -> T { // SAFETY: we are reading from a reference, which is guaranteed From 63f4b36406016ad62cfe23580ed90ef1eabd4bfb Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Tue, 11 Nov 2025 22:36:50 -0500 Subject: [PATCH 04/15] provide an error if an autodiff user does not set in their Cargo.toml --- compiler/rustc_codegen_llvm/messages.ftl | 1 + compiler/rustc_codegen_llvm/src/errors.rs | 4 ++++ compiler/rustc_codegen_llvm/src/intrinsic.rs | 5 ++++- compiler/rustc_session/src/session.rs | 8 -------- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_codegen_llvm/messages.ftl b/compiler/rustc_codegen_llvm/messages.ftl index ce9a51b539d83..c9d28160d66f7 100644 --- a/compiler/rustc_codegen_llvm/messages.ftl +++ b/compiler/rustc_codegen_llvm/messages.ftl @@ -1,4 +1,5 @@ codegen_llvm_autodiff_without_enable = using the autodiff feature requires -Z autodiff=Enable +codegen_llvm_autodiff_without_lto = using the autodiff feature requires setting `lto="fat"` in your Cargo.toml codegen_llvm_copy_bitcode = failed to copy bitcode to object file: {$err} diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index 627b0c9ff3b33..629afee8a6677 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -32,6 +32,10 @@ impl Diagnostic<'_, G> for ParseTargetMachineConfig<'_> { } } +#[derive(Diagnostic)] +#[diag(codegen_llvm_autodiff_without_lto)] +pub(crate) struct AutoDiffWithoutLto; + #[derive(Diagnostic)] #[diag(codegen_llvm_autodiff_without_enable)] pub(crate) struct AutoDiffWithoutEnable; diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 0626cb3f2f16b..bbe3b5b59f5b4 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -24,7 +24,7 @@ use crate::abi::FnAbiLlvmExt; use crate::builder::Builder; use crate::builder::autodiff::{adjust_activity_to_abi, generate_enzyme_call}; use crate::context::CodegenCx; -use crate::errors::AutoDiffWithoutEnable; +use crate::errors::{AutoDiffWithoutEnable, AutoDiffWithoutLto}; use crate::llvm::{self, Metadata, Type, Value}; use crate::type_of::LayoutLlvmExt; use crate::va_arg::emit_va_arg; @@ -1145,6 +1145,9 @@ fn codegen_autodiff<'ll, 'tcx>( if !tcx.sess.opts.unstable_opts.autodiff.contains(&rustc_session::config::AutoDiff::Enable) { let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutEnable); } + if tcx.sess.lto() != rustc_session::config::Lto::Fat { + let _ = tcx.dcx().emit_almost_fatal(AutoDiffWithoutLto); + } let fn_args = instance.args; let callee_ty = instance.ty(tcx, bx.typing_env()); diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 9fb3c35d5ef73..fe13bb821c9b7 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -594,14 +594,6 @@ impl Session { /// Calculates the flavor of LTO to use for this compilation. pub fn lto(&self) -> config::Lto { - // Autodiff currently requires fat-lto to have access to the llvm-ir of all (indirectly) used functions and types. - // fat-lto is the easiest solution to this requirement, but quite expensive. - // FIXME(autodiff): Make autodiff also work with embed-bc instead of fat-lto. - // Don't apply fat-lto to proc-macro crates as they cannot use fat-lto without -Zdylib-lto - if self.opts.autodiff_enabled() && !self.opts.crate_types.contains(&CrateType::ProcMacro) { - return config::Lto::Fat; - } - // If our target has codegen requirements ignore the command line if self.target.requires_lto { return config::Lto::Fat; From c8bae8c06ed1dd08a55a6cdd1b80d51c59a21359 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Tue, 11 Nov 2025 22:46:17 -0500 Subject: [PATCH 05/15] add a test to verify a good error for enabling autodiff without lto --- tests/ui/autodiff/no_lto_flag.no_lto.stderr | 4 +++ tests/ui/autodiff/no_lto_flag.rs | 31 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/ui/autodiff/no_lto_flag.no_lto.stderr create mode 100644 tests/ui/autodiff/no_lto_flag.rs diff --git a/tests/ui/autodiff/no_lto_flag.no_lto.stderr b/tests/ui/autodiff/no_lto_flag.no_lto.stderr new file mode 100644 index 0000000000000..abc6af5b62965 --- /dev/null +++ b/tests/ui/autodiff/no_lto_flag.no_lto.stderr @@ -0,0 +1,4 @@ +error: using the autodiff feature requires setting `lto="fat"` in your Cargo.toml + +error: aborting due to 1 previous error + diff --git a/tests/ui/autodiff/no_lto_flag.rs b/tests/ui/autodiff/no_lto_flag.rs new file mode 100644 index 0000000000000..6194b1effc34f --- /dev/null +++ b/tests/ui/autodiff/no_lto_flag.rs @@ -0,0 +1,31 @@ +//@ needs-enzyme +//@ no-prefer-dynamic +//@ revisions: with_lto no_lto +//@[with_lto] compile-flags: -Zautodiff=Enable -C opt-level=3 -Clto=fat +//@[no_lto] compile-flags: -Zautodiff=Enable -C opt-level=3 -Clto=thin + +#![feature(autodiff)] +//@[no_lto] build-fail +//@[with_lto] build-pass + +// Autodiff requires users to enable lto=fat (for now). +// In the past, autodiff did not run if users forget to enable fat-lto, which caused functions to +// returning zero-derivatives. That's obviously wrong and confusing to users. We now added a check +// which will abort compilation instead. + +use std::autodiff::autodiff_reverse; +//[no_lto]~? ERROR using the autodiff feature requires setting `lto="fat"` in your Cargo.toml + +#[autodiff_reverse(d_square, Duplicated, Active)] +fn square(x: &f64) -> f64 { + *x * *x +} + +fn main() { + let xf64: f64 = std::hint::black_box(3.0); + + let mut df_dxf64: f64 = std::hint::black_box(0.0); + + let _output_f64 = d_square(&xf64, &mut df_dxf64, 1.0); + assert_eq!(6.0, df_dxf64); +} From 4996edc53d69125e2f0828ce61206b1081ceda0c Mon Sep 17 00:00:00 2001 From: msmoiz Date: Thu, 13 Nov 2025 08:36:22 -0800 Subject: [PATCH 06/15] add note to `lines` docs about empty str behavior --- library/core/src/str/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 45308c4b3e9c5..88d3cc8b5a6f9 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1251,6 +1251,8 @@ impl str { /// ending will return the same lines as an otherwise identical string /// without a final line ending. /// + /// An empty string returns no lines. + /// /// # Examples /// /// Basic usage: @@ -1281,6 +1283,15 @@ impl str { /// /// assert_eq!(None, lines.next()); /// ``` + /// + /// An empty string returns no lines: + /// + /// ``` + /// let text = ""; + /// let mut lines = text.lines(); + /// + /// assert_eq!(lines.next(), None); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn lines(&self) -> Lines<'_> { From e628b059bbf99b7681a3147c2c4ecc151b5a7cd4 Mon Sep 17 00:00:00 2001 From: msmoiz Date: Thu, 13 Nov 2025 16:44:07 -0800 Subject: [PATCH 07/15] update language from "no lines" to "empty iterator" --- library/core/src/str/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 88d3cc8b5a6f9..ab7389a1300c5 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1251,7 +1251,7 @@ impl str { /// ending will return the same lines as an otherwise identical string /// without a final line ending. /// - /// An empty string returns no lines. + /// An empty string returns an empty iterator. /// /// # Examples /// @@ -1284,7 +1284,7 @@ impl str { /// assert_eq!(None, lines.next()); /// ``` /// - /// An empty string returns no lines: + /// An empty string returns an empty iterator: /// /// ``` /// let text = ""; From 4fd0dc10500bd0080a73d4b971865bc81ee74fcc Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sun, 16 Nov 2025 13:13:18 +0100 Subject: [PATCH 08/15] move `NonNull` into `minicore` --- tests/auxiliary/minicore.rs | 18 ++++++++++++++++++ tests/ui/abi/compatibility.rs | 18 ------------------ .../cmse-nonsecure-entry/c-variadic.rs | 3 +-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index a974dee8a8389..288a5b50dd5ef 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -119,6 +119,24 @@ pub struct ManuallyDrop { } impl Copy for ManuallyDrop {} +#[repr(transparent)] +#[rustc_layout_scalar_valid_range_start(1)] +#[rustc_nonnull_optimization_guaranteed] +pub struct NonNull { + pointer: *const T, +} +impl Copy for NonNull {} + +#[repr(transparent)] +#[rustc_layout_scalar_valid_range_start(1)] +#[rustc_nonnull_optimization_guaranteed] +pub struct NonZero(T); + +pub struct Unique { + pub pointer: NonNull, + pub _marker: PhantomData, +} + #[lang = "unsafe_cell"] #[repr(transparent)] pub struct UnsafeCell { diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 350b98191cf57..1bd032e877a83 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -87,19 +87,6 @@ mod prelude { fn clone(&self) -> Self; } - #[repr(transparent)] - #[rustc_layout_scalar_valid_range_start(1)] - #[rustc_nonnull_optimization_guaranteed] - pub struct NonNull { - pointer: *const T, - } - impl Copy for NonNull {} - - #[repr(transparent)] - #[rustc_layout_scalar_valid_range_start(1)] - #[rustc_nonnull_optimization_guaranteed] - pub struct NonZero(T); - // This just stands in for a non-trivial type. pub struct Vec { ptr: NonNull, @@ -107,11 +94,6 @@ mod prelude { len: usize, } - pub struct Unique { - pub pointer: NonNull, - pub _marker: PhantomData, - } - #[lang = "global_alloc_ty"] pub struct Global; diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs index d921f5cff627f..d4a6c1fa07c14 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs @@ -31,9 +31,8 @@ async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() { // this file, but they may be moved into `minicore` if/when other `#[no_core]` tests want to use // them. -// NOTE: in `core` this type uses `NonNull`. #[lang = "ResumeTy"] -pub struct ResumeTy(*mut Context<'static>); +pub struct ResumeTy(NonNull>); #[lang = "future_trait"] pub trait Future { From 96c64272e2a913d41232ed69c652bdb47433a15c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sun, 16 Nov 2025 13:13:59 +0100 Subject: [PATCH 09/15] `abi/compatibility`: test some additional targets --- tests/ui/abi/compatibility.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 1bd032e877a83..ce662d3fe28b0 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -13,6 +13,9 @@ //@ revisions: arm //@[arm] compile-flags: --target arm-unknown-linux-gnueabi //@[arm] needs-llvm-components: arm +//@ revisions: thumb +//@[thumb] compile-flags: --target thumbv8m.main-none-eabi +//@[thumb] needs-llvm-components: arm //@ revisions: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: aarch64 @@ -31,12 +34,21 @@ //@ revisions: sparc64 //@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu //@[sparc64] needs-llvm-components: sparc +//@ revisions: powerpc +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc //@ revisions: powerpc64 //@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu //@[powerpc64] needs-llvm-components: powerpc +//@ revisions: aix +//@[aix] compile-flags: --target powerpc64-ibm-aix +//@[aix] needs-llvm-components: powerpc //@ revisions: riscv //@[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu //@[riscv] needs-llvm-components: riscv +//@ revisions: loongarch32 +//@[loongarch32] compile-flags: --target loongarch32-unknown-none +//@[loongarch32] needs-llvm-components: loongarch //@ revisions: loongarch64 //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch From 02770b339bfaa86be2fecbcd3981fa837caeb286 Mon Sep 17 00:00:00 2001 From: "U. Lasiotus" Date: Fri, 14 Nov 2025 10:18:03 -0800 Subject: [PATCH 10/15] remote-test-server: make it build for Motor OS Had to tweak linking options in target spec to make it work (see https://github.com/moturus/motor-os/issues/46). --- compiler/rustc_target/src/spec/base/motor.rs | 14 +++----------- .../src/spec/targets/x86_64_unknown_motor.rs | 3 +-- src/tools/remote-test-server/src/main.rs | 12 ++++++------ 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_target/src/spec/base/motor.rs b/compiler/rustc_target/src/spec/base/motor.rs index 7b75c9bf253a6..67dab01b39f76 100644 --- a/compiler/rustc_target/src/spec/base/motor.rs +++ b/compiler/rustc_target/src/spec/base/motor.rs @@ -4,16 +4,8 @@ use crate::spec::{ pub(crate) fn opts() -> TargetOptions { let pre_link_args = TargetOptions::link_args( - LinkerFlavor::Gnu(Cc::No, Lld::No), - &[ - "-e", - "motor_start", - "--no-undefined", - "--error-unresolved-symbols", - "--no-undefined-version", - "-u", - "__rust_abort", - ], + LinkerFlavor::Gnu(Cc::Yes, Lld::No), + &["-e", "motor_start", "-u", "__rust_abort"], ); TargetOptions { os: Os::Motor, @@ -23,7 +15,7 @@ pub(crate) fn opts() -> TargetOptions { // We use "OS level" TLS (see thread/local.rs in stdlib). has_thread_local: false, frame_pointer: FramePointer::NonLeaf, - linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::No), + linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), main_needs_argc_argv: true, panic_strategy: PanicStrategy::Abort, pre_link_args, diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_motor.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_motor.rs index 3be05b79954f2..61a25f613ebfb 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_motor.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_motor.rs @@ -1,5 +1,5 @@ use crate::spec::{ - Arch, CodeModel, LinkSelfContainedDefault, LldFlavor, RelocModel, RelroLevel, Target, base, + Arch, CodeModel, LinkSelfContainedDefault, RelocModel, RelroLevel, Target, base, }; pub(crate) fn target() -> Target { @@ -15,7 +15,6 @@ pub(crate) fn target() -> Target { base.relro_level = RelroLevel::Full; base.static_position_independent_executables = true; base.relocation_model = RelocModel::Pic; - base.lld_flavor_json = LldFlavor::Ld; base.link_self_contained = LinkSelfContainedDefault::True; base.dynamic_linking = false; base.crt_static_default = true; diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 5ec5e6e28982d..bfe8f54937f60 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -10,13 +10,13 @@ //! themselves having support libraries. All data over the TCP sockets is in a //! basically custom format suiting our needs. -#[cfg(not(windows))] +#[cfg(all(not(windows), not(target_os = "motor")))] use std::fs::Permissions; use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, BufReader}; use std::net::{SocketAddr, TcpListener, TcpStream}; -#[cfg(not(windows))] +#[cfg(all(not(windows), not(target_os = "motor")))] use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use std::process::{Command, ExitStatus, Stdio}; @@ -325,7 +325,7 @@ fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>, conf ])); } -#[cfg(not(windows))] +#[cfg(all(not(windows), not(target_os = "motor")))] fn get_status_code(status: &ExitStatus) -> (u8, i32) { match status.code() { Some(n) => (0, n), @@ -333,7 +333,7 @@ fn get_status_code(status: &ExitStatus) -> (u8, i32) { } } -#[cfg(windows)] +#[cfg(any(windows, target_os = "motor"))] fn get_status_code(status: &ExitStatus) -> (u8, i32) { (0, status.code().unwrap()) } @@ -359,11 +359,11 @@ fn recv(dir: &Path, io: &mut B) -> PathBuf { dst } -#[cfg(not(windows))] +#[cfg(all(not(windows), not(target_os = "motor")))] fn set_permissions(path: &Path) { t!(fs::set_permissions(&path, Permissions::from_mode(0o755))); } -#[cfg(windows)] +#[cfg(any(windows, target_os = "motor"))] fn set_permissions(_path: &Path) {} fn my_copy(src: &mut dyn Read, which: u8, dst: &Mutex) { From 64f0579973c890824197d760e1cd1bcf25261792 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 15 Nov 2025 00:41:45 -0500 Subject: [PATCH 11/15] Run wasm32-wasip1 codegen tests in PR CI --- src/ci/docker/host-x86_64/pr-check-2/Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile index c005eceb6ef4a..c9c3e3d2a3306 100644 --- a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile @@ -21,6 +21,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ mingw-w64 \ && rm -rf /var/lib/apt/lists/* +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ + tar -xz +ENV WASI_SDK_PATH=/wasi-sdk-27.0-x86_64-linux + ENV RUST_CONFIGURE_ARGS="--set rust.validate-mir-opts=3" COPY scripts/sccache.sh /scripts/ @@ -30,6 +34,10 @@ ENV SCRIPT \ python3 ../x.py check && \ python3 ../x.py clippy ci --stage 2 && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ + # Elsewhere, we run all tests for the host. A number of codegen tests are sensitive to the target pointer + # width, for example because they mention a usize. wasm32-wasip1 in test-various, so using it here can't make + # PR CI more strict than full CI. + python3 ../x.py test --stage 1 tests/codegen-llvm --target wasm32-wasip1 && \ python3 ../x.py test --stage 1 src/tools/compiletest && \ python3 ../x.py doc bootstrap --stage 1 && \ # Build both public and internal documentation. From c287f6e4650dc209aff02d47927a0d0c8c6cfdc9 Mon Sep 17 00:00:00 2001 From: Jamie Hill-Daniel Date: Sun, 16 Nov 2025 20:28:56 +0000 Subject: [PATCH 12/15] compiletest: Avoid race condition in file deletion --- src/tools/compiletest/src/runtest.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 8527f7e8128f4..ddcda91c13d01 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2766,12 +2766,11 @@ impl<'test> TestCx<'test> { .map_err(|err| format!("failed to load expected output from `{}`: {}", path, err)) } + /// Attempts to delete a file, succeeding if the file does not exist. fn delete_file(&self, file: &Utf8Path) { - if !file.exists() { - // Deleting a nonexistent file would error. - return; - } - if let Err(e) = fs::remove_file(file.as_std_path()) { + if let Err(e) = fs::remove_file(file.as_std_path()) + && e.kind() != io::ErrorKind::NotFound + { self.fatal(&format!("failed to delete `{}`: {}", file, e,)); } } From 7194c921cad605e65a044d524a30415555e2e809 Mon Sep 17 00:00:00 2001 From: cyrgani Date: Tue, 4 Nov 2025 23:16:15 +0100 Subject: [PATCH 13/15] add larger test for `proc_macro` `FromStr` implementations --- .../auxiliary/nonfatal-parsing-body.rs | 143 +++++++++++++ .../proc-macro/auxiliary/nonfatal-parsing.rs | 11 + tests/ui/proc-macro/nonfatal-parsing.rs | 19 ++ tests/ui/proc-macro/nonfatal-parsing.stderr | 197 ++++++++++++++++++ tests/ui/proc-macro/nonfatal-parsing.stdout | 54 +++++ 5 files changed, 424 insertions(+) create mode 100644 tests/ui/proc-macro/auxiliary/nonfatal-parsing-body.rs create mode 100644 tests/ui/proc-macro/auxiliary/nonfatal-parsing.rs create mode 100644 tests/ui/proc-macro/nonfatal-parsing.rs create mode 100644 tests/ui/proc-macro/nonfatal-parsing.stderr create mode 100644 tests/ui/proc-macro/nonfatal-parsing.stdout diff --git a/tests/ui/proc-macro/auxiliary/nonfatal-parsing-body.rs b/tests/ui/proc-macro/auxiliary/nonfatal-parsing-body.rs new file mode 100644 index 0000000000000..854d27d7ed323 --- /dev/null +++ b/tests/ui/proc-macro/auxiliary/nonfatal-parsing-body.rs @@ -0,0 +1,143 @@ +use std::fmt::Debug; +use std::panic::catch_unwind; +use std::str::FromStr; + +use proc_macro::*; + +use self::Mode::*; + +// FIXME: all cases should become `NormalOk` or `NormalErr` +#[derive(PartialEq, Clone, Copy)] +enum Mode { + NormalOk, + NormalErr, + OtherError, + OtherWithPanic, +} + +fn parse(s: &str, mode: Mode) +where + T: FromStr + Debug, +{ + match mode { + NormalOk => { + let t = T::from_str(s); + println!("{:?}", t); + assert!(t.is_ok()); + } + NormalErr => { + let t = T::from_str(s); + println!("{:?}", t); + assert!(t.is_err()); + } + OtherError => { + println!("{:?}", T::from_str(s)); + } + OtherWithPanic => { + if catch_unwind(|| println!("{:?}", T::from_str(s))).is_ok() { + eprintln!("{s} did not panic"); + } + } + } +} + +fn stream(s: &str, mode: Mode) { + parse::(s, mode); +} + +fn lit(s: &str, mode: Mode) { + parse::(s, mode); + if mode == NormalOk { + let Ok(lit) = Literal::from_str(s) else { + panic!("literal was not ok"); + }; + let Ok(stream) = TokenStream::from_str(s) else { + panic!("tokenstream was not ok, but literal was"); + }; + let Some(tree) = stream.into_iter().next() else { + panic!("tokenstream should have a tokentree"); + }; + if let TokenTree::Literal(tokenstream_lit) = tree { + assert_eq!(lit.to_string(), tokenstream_lit.to_string()); + } + } +} + +pub fn run() { + // returns Ok(valid instance) + lit("123", NormalOk); + lit("\"ab\"", NormalOk); + lit("\'b\'", NormalOk); + lit("'b'", NormalOk); + lit("b\"b\"", NormalOk); + lit("c\"b\"", NormalOk); + lit("cr\"b\"", NormalOk); + lit("b'b'", NormalOk); + lit("256u8", NormalOk); + lit("-256u8", NormalOk); + stream("-256u8", NormalOk); + lit("0b11111000000001111i16", NormalOk); + lit("0xf32", NormalOk); + lit("0b0f32", NormalOk); + lit("2E4", NormalOk); + lit("2.2E-4f64", NormalOk); + lit("18u8E", NormalOk); + lit("18.0u8E", NormalOk); + lit("cr#\"// /* // \n */\"#", NormalOk); + lit("'\\''", NormalOk); + lit("'\\\''", NormalOk); + lit(&format!("r{0}\"a\"{0}", "#".repeat(255)), NormalOk); + stream("fn main() { println!(\"Hello, world!\") }", NormalOk); + stream("18.u8E", NormalOk); + stream("18.0f32", NormalOk); + stream("18.0f34", NormalOk); + stream("18.bu8", NormalOk); + stream("3//\n4", NormalOk); + stream( + "\'c\'/*\n + */", + NormalOk, + ); + stream("/*a*/ //", NormalOk); + + println!("### ERRORS"); + + // returns Err(LexError) + lit("\'c\'/**/", NormalErr); + lit(" 0", NormalErr); + lit("0 ", NormalErr); + lit("0//", NormalErr); + lit("3//\n4", NormalErr); + lit("18.u8E", NormalErr); + lit("/*a*/ //", NormalErr); + // FIXME: all of the cases below should return an Err and emit no diagnostics, but don't yet. + + // emits diagnostics and returns LexError + lit("r'r'", OtherError); + lit("c'r'", OtherError); + + // emits diagnostic and returns a seemingly valid tokenstream + stream("r'r'", OtherError); + stream("c'r'", OtherError); + + for parse in [stream as fn(&str, Mode), lit] { + // emits diagnostic(s), then panics + parse("1 ) 2", OtherWithPanic); + parse("( x [ ) ]", OtherWithPanic); + parse("r#", OtherWithPanic); + + // emits diagnostic(s), then returns Ok(Literal { kind: ErrWithGuar, .. }) + parse("0b2", OtherError); + parse("0bf32", OtherError); + parse("0b0.0f32", OtherError); + parse("'\''", OtherError); + parse( + "' +'", OtherError, + ); + parse(&format!("r{0}\"a\"{0}", "#".repeat(256)), OtherWithPanic); + + // emits diagnostic, then, when parsing as a lit, returns LexError, otherwise ErrWithGuar + parse("/*a*/ 0b2 //", OtherError); + } +} diff --git a/tests/ui/proc-macro/auxiliary/nonfatal-parsing.rs b/tests/ui/proc-macro/auxiliary/nonfatal-parsing.rs new file mode 100644 index 0000000000000..75db8ee3c5fc8 --- /dev/null +++ b/tests/ui/proc-macro/auxiliary/nonfatal-parsing.rs @@ -0,0 +1,11 @@ +extern crate proc_macro; +use proc_macro::*; + +#[path = "nonfatal-parsing-body.rs"] +mod body; + +#[proc_macro] +pub fn run(_: TokenStream) -> TokenStream { + body::run(); + TokenStream::new() +} diff --git a/tests/ui/proc-macro/nonfatal-parsing.rs b/tests/ui/proc-macro/nonfatal-parsing.rs new file mode 100644 index 0000000000000..853cbfd075e7b --- /dev/null +++ b/tests/ui/proc-macro/nonfatal-parsing.rs @@ -0,0 +1,19 @@ +//@ proc-macro: nonfatal-parsing.rs +//@ needs-unwind +//@ edition: 2024 +//@ dont-require-annotations: ERROR +//@ ignore-backends: gcc +// FIXME: should be a run-pass test once invalidly parsed tokens no longer result in diagnostics + +extern crate proc_macro; +extern crate nonfatal_parsing; + +#[path = "auxiliary/nonfatal-parsing-body.rs"] +mod body; + +fn main() { + nonfatal_parsing::run!(); + // FIXME: enable this once the standalone backend exists + // https://github.com/rust-lang/rust/issues/130856 + // body::run(); +} diff --git a/tests/ui/proc-macro/nonfatal-parsing.stderr b/tests/ui/proc-macro/nonfatal-parsing.stderr new file mode 100644 index 0000000000000..00c5c6ecfa8ea --- /dev/null +++ b/tests/ui/proc-macro/nonfatal-parsing.stderr @@ -0,0 +1,197 @@ +error: prefix `r` is unknown + --> :1:1 + | +LL | r'r' + | ^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | r 'r' + | + + +error: prefix `c` is unknown + --> :1:1 + | +LL | c'r' + | ^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | c 'r' + | + + +error: unexpected closing delimiter: `)` + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ unexpected closing delimiter + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected closing delimiter: `]` + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | -^^^^^^^^^^^^^^^^^^^^^^^ + | | + | the nearest open delimiter + | missing open `(` for this delimiter + | unexpected closing delimiter + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: found invalid character; only `#` is allowed in raw string delimitation: \u{0} + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid digit for a base 2 literal + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0768]: no valid digits found for number + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: binary float literal is not supported + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: character constant must be escaped: `'` + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) +help: escape the character + | +LL - nonfatal_parsing::run!(); +LL + nonfatal_parsing::run!(\'; + | + +error: character constant must be escaped: `\n` + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) +help: escape the character + | +LL - nonfatal_parsing::run!(); +LL + nonfatal_parsing::run!(\n; + | + +error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: invalid digit for a base 2 literal + --> $DIR/nonfatal-parsing.rs:15:5 + | +LL | nonfatal_parsing::run!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: unexpected closing delimiter: `)` + --> :1:3 + | +LL | 1 ) 2 + | ^ unexpected closing delimiter + +error: unexpected closing delimiter: `]` + --> :1:10 + | +LL | ( x [ ) ] + | - - ^ unexpected closing delimiter + | | | + | | missing open `(` for this delimiter + | the nearest open delimiter + +error: found invalid character; only `#` is allowed in raw string delimitation: \u{0} + --> :1:1 + | +LL | r# + | ^^ + +error: invalid digit for a base 2 literal + --> :1:3 + | +LL | 0b2 + | ^ + +error[E0768]: no valid digits found for number + --> :1:1 + | +LL | 0bf32 + | ^^ + +error: binary float literal is not supported + --> :1:1 + | +LL | 0b0.0f32 + | ^^^^^ + +error: character constant must be escaped: `'` + --> :1:2 + | +LL | ''' + | ^ + | +help: escape the character + | +LL | '\'' + | + + +error: character constant must be escaped: `\n` + --> :1:2 + | +LL | ' + | __^ +LL | | ' + | |_^ + | +help: escape the character + | +LL | '\n' + | ++ + +error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 + --> :1:1 + | +LL | r#######################################...################################################## + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: invalid digit for a base 2 literal + --> :1:9 + | +LL | /*a*/ 0b2 // + | ^ + +error: aborting due to 22 previous errors + +For more information about this error, try `rustc --explain E0768`. diff --git a/tests/ui/proc-macro/nonfatal-parsing.stdout b/tests/ui/proc-macro/nonfatal-parsing.stdout new file mode 100644 index 0000000000000..08e0e6b1f8439 --- /dev/null +++ b/tests/ui/proc-macro/nonfatal-parsing.stdout @@ -0,0 +1,54 @@ +Ok(Literal { kind: Integer, symbol: "123", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Str, symbol: "ab", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Char, symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Char, symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: ByteStr, symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: CStr, symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: CStrRaw(0), symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Byte, symbol: "b", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Integer, symbol: "256", suffix: Some("u8"), span: #44 bytes(361..385) }) +Ok(Literal { kind: Integer, symbol: "-256", suffix: Some("u8"), span: #44 bytes(361..385) }) +Ok(TokenStream [Punct { ch: '-', spacing: Alone, span: #44 bytes(361..385) }, Literal { kind: Integer, symbol: "256", suffix: Some("u8"), span: #44 bytes(361..385) }]) +Ok(Literal { kind: Integer, symbol: "0b11111000000001111", suffix: Some("i16"), span: #44 bytes(361..385) }) +Ok(Literal { kind: Integer, symbol: "0xf32", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Integer, symbol: "0b0", suffix: Some("f32"), span: #44 bytes(361..385) }) +Ok(Literal { kind: Float, symbol: "2E4", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Float, symbol: "2.2E-4", suffix: Some("f64"), span: #44 bytes(361..385) }) +Ok(Literal { kind: Integer, symbol: "18", suffix: Some("u8E"), span: #44 bytes(361..385) }) +Ok(Literal { kind: Float, symbol: "18.0", suffix: Some("u8E"), span: #44 bytes(361..385) }) +Ok(Literal { kind: CStrRaw(1), symbol: "// /* // \n */", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Char, symbol: "\'", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: Char, symbol: "\'", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: StrRaw(255), symbol: "a", suffix: None, span: #44 bytes(361..385) }) +Ok(TokenStream [Ident { ident: "fn", span: #44 bytes(361..385) }, Ident { ident: "main", span: #44 bytes(361..385) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #44 bytes(361..385) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "println", span: #44 bytes(361..385) }, Punct { ch: '!', spacing: Alone, span: #44 bytes(361..385) }, Group { delimiter: Parenthesis, stream: TokenStream [Literal { kind: Str, symbol: "Hello, world!", suffix: None, span: #44 bytes(361..385) }], span: #44 bytes(361..385) }], span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Integer, symbol: "18", suffix: None, span: #44 bytes(361..385) }, Punct { ch: '.', spacing: Alone, span: #44 bytes(361..385) }, Ident { ident: "u8E", span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Float, symbol: "18.0", suffix: Some("f32"), span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Float, symbol: "18.0", suffix: Some("f34"), span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Integer, symbol: "18", suffix: None, span: #44 bytes(361..385) }, Punct { ch: '.', spacing: Alone, span: #44 bytes(361..385) }, Ident { ident: "bu8", span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Integer, symbol: "3", suffix: None, span: #44 bytes(361..385) }, Literal { kind: Integer, symbol: "4", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: Char, symbol: "c", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream []) +### ERRORS +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Err(LexError) +Ok(TokenStream [Ident { ident: "r", span: #44 bytes(361..385) }, Literal { kind: Char, symbol: "r", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Ident { ident: "c", span: #44 bytes(361..385) }, Literal { kind: Char, symbol: "r", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "0b2", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "0b", suffix: Some("f32"), span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "0b0.0", suffix: Some("f32"), span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "'''", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "'\n'", suffix: None, span: #44 bytes(361..385) }]) +Ok(TokenStream [Literal { kind: ErrWithGuar, symbol: "0b2", suffix: None, span: #44 bytes(361..385) }]) +Ok(Literal { kind: ErrWithGuar, symbol: "0b2", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: ErrWithGuar, symbol: "0b", suffix: Some("f32"), span: #44 bytes(361..385) }) +Ok(Literal { kind: ErrWithGuar, symbol: "0b0.0", suffix: Some("f32"), span: #44 bytes(361..385) }) +Ok(Literal { kind: ErrWithGuar, symbol: "'''", suffix: None, span: #44 bytes(361..385) }) +Ok(Literal { kind: ErrWithGuar, symbol: "'\n'", suffix: None, span: #44 bytes(361..385) }) +Err(LexError) From 70a0af3f4e4a3e0b14f6c3acd774ba1210aaad61 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Sun, 16 Nov 2025 16:11:15 -0800 Subject: [PATCH 14/15] Remove jsha from notifications for rustdoc HTML --- triagebot.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/triagebot.toml b/triagebot.toml index 0bf310e8fd7ef..f901dc7efc1e6 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1070,7 +1070,6 @@ source file via `./x run src/tools/unicode-table-generator` instead of editing \ message = "Some changes occurred in HTML/CSS/JS." cc = [ "@GuillaumeGomez", - "@jsha", "@lolbinarycat", ] From 31902f3838cc624de8092fd8d43bf284a36b7ce5 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Mon, 17 Nov 2025 14:10:28 +1100 Subject: [PATCH 15/15] Remove the "wasm32-bare" alias for `wasm32-unknown-unknown` There is no compelling reason to use this alias instead of the full target name. --- src/doc/rustc-dev-guide/src/tests/directives.md | 1 - src/tools/compiletest/src/directives/cfg.rs | 8 -------- src/tools/compiletest/src/directives/directive_names.rs | 4 ++-- src/tools/compiletest/src/directives/tests.rs | 4 ---- .../stack-protector/stack-protector-heuristics-effect.rs | 2 +- tests/run-make/wasm-exceptions-nostd/rmake.rs | 2 +- 6 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 5d626e3c92d15..4226c1750ef2c 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -141,7 +141,6 @@ Some examples of `X` in `ignore-X` or `only-X`: - OS: `android`, `emscripten`, `freebsd`, `ios`, `linux`, `macos`, `windows`, ... - Environment (fourth word of the target triple): `gnu`, `msvc`, `musl` -- WASM: `wasm32-bare` matches `wasm32-unknown-unknown`. - Pointer width: `32bit`, `64bit` - Endianness: `endian-big` - Stage: `stage1`, `stage2` diff --git a/src/tools/compiletest/src/directives/cfg.rs b/src/tools/compiletest/src/directives/cfg.rs index 10795eee0fefa..1735866bf2cd6 100644 --- a/src/tools/compiletest/src/directives/cfg.rs +++ b/src/tools/compiletest/src/directives/cfg.rs @@ -147,14 +147,6 @@ fn parse_cfg_name_directive<'a>( message: "when the target family is {name}" } - // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown - // (in contrast to `wasm32` which also matches non-bare targets) - condition! { - name: "wasm32-bare", - condition: config.target == "wasm32-unknown-unknown", - message: "when the target is WASM" - } - condition! { name: "thumb", condition: config.target.starts_with("thumb"), diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index d2f5b3dba3dd7..8d1232a47596b 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -125,7 +125,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-wasi", "ignore-wasm", "ignore-wasm32", - "ignore-wasm32-bare", + "ignore-wasm32-unknown-unknown", "ignore-wasm64", "ignore-watchos", "ignore-windows", @@ -240,7 +240,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "only-unix", "only-visionos", "only-wasm32", - "only-wasm32-bare", + "only-wasm32-unknown-unknown", "only-wasm32-wasip1", "only-watchos", "only-windows", diff --git a/src/tools/compiletest/src/directives/tests.rs b/src/tools/compiletest/src/directives/tests.rs index 419bf0cfcd2f6..649dc85703419 100644 --- a/src/tools/compiletest/src/directives/tests.rs +++ b/src/tools/compiletest/src/directives/tests.rs @@ -710,18 +710,14 @@ fn wasm_special() { let ignores = [ ("wasm32-unknown-unknown", "emscripten", false), ("wasm32-unknown-unknown", "wasm32", true), - ("wasm32-unknown-unknown", "wasm32-bare", true), ("wasm32-unknown-unknown", "wasm64", false), ("wasm32-unknown-emscripten", "emscripten", true), ("wasm32-unknown-emscripten", "wasm32", true), - ("wasm32-unknown-emscripten", "wasm32-bare", false), ("wasm32-wasip1", "emscripten", false), ("wasm32-wasip1", "wasm32", true), - ("wasm32-wasip1", "wasm32-bare", false), ("wasm32-wasip1", "wasi", true), ("wasm64-unknown-unknown", "emscripten", false), ("wasm64-unknown-unknown", "wasm32", false), - ("wasm64-unknown-unknown", "wasm32-bare", false), ("wasm64-unknown-unknown", "wasm64", true), ]; for (target, pattern, ignore) in ignores { diff --git a/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs b/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs index ae281cb95da5f..3728ff3adf105 100644 --- a/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs +++ b/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs @@ -3,7 +3,7 @@ //@ ignore-apple slightly different policy on stack protection of arrays //@ ignore-msvc stack check code uses different function names //@ ignore-nvptx64 stack protector is not supported -//@ ignore-wasm32-bare +//@ ignore-wasm32-unknown-unknown //@ [all] compile-flags: -Z stack-protector=all //@ [strong] compile-flags: -Z stack-protector=strong //@ [basic] compile-flags: -Z stack-protector=basic diff --git a/tests/run-make/wasm-exceptions-nostd/rmake.rs b/tests/run-make/wasm-exceptions-nostd/rmake.rs index 720ee9909d2ab..e43d6bcd02b80 100644 --- a/tests/run-make/wasm-exceptions-nostd/rmake.rs +++ b/tests/run-make/wasm-exceptions-nostd/rmake.rs @@ -1,4 +1,4 @@ -//@ only-wasm32-bare +//@ only-wasm32-unknown-unknown use std::path::Path;