diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index c8aa7c04585c8..b633d0c35180e 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -685,7 +685,8 @@ pub fn codegen_crate( tcx: TyCtxt<'_>, target_cpu: String, ) -> OngoingCodegen { - if tcx.sess.target.need_explicit_cpu && tcx.sess.opts.cg.target_cpu.is_none() { + if tcx.sess.target.requires_explicit_and_consistent_cpu && tcx.sess.opts.cg.target_cpu.is_none() + { // The target has no default cpu, but none is set explicitly tcx.dcx().emit_fatal(errors::CpuRequired); } diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl index fac7b6c21f60c..8df7d19835621 100644 --- a/compiler/rustc_metadata/messages.ftl +++ b/compiler/rustc_metadata/messages.ftl @@ -112,17 +112,29 @@ metadata_incompatible_target_modifiers = metadata_incompatible_target_modifiers_help_allow = if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error metadata_incompatible_target_modifiers_help_fix = set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}` -metadata_incompatible_target_modifiers_help_fix_l_missed = set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}` +metadata_incompatible_target_modifiers_help_fix_l_missed = set {$value_len -> + [0] `{$flag_name_prefixed}` + *[other] `{$flag_name_prefixed}={$extern_value}` + } in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}` -metadata_incompatible_target_modifiers_help_fix_r_missed = unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}` +metadata_incompatible_target_modifiers_help_fix_r_missed = unset `{$flag_name_prefixed}` in this crate or set {$value_len -> + [0] `{$flag_name_prefixed}` + *[other] `{$flag_name_prefixed}={$local_value}` + } in `{$extern_crate}` metadata_incompatible_target_modifiers_l_missed = mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}` - .note = unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}` + .note = `{$flag_name_prefixed}` is unset in this crate which is incompatible with {$value_len -> + [0] `{$flag_name_prefixed}` being set + *[other] `{$flag_name_prefixed}={$extern_value}` + } in dependency `{$extern_crate}` .help = the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely metadata_incompatible_target_modifiers_r_missed = mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}` - .note = `{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}` + .note = {$value_len -> + [0] `{$flag_name_prefixed}` being set + *[other] `{$flag_name_prefixed}={$local_value}` + } in this crate is incompatible with `{$flag_name_prefixed}` being unset in dependency `{$extern_crate}` .help = the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely metadata_incompatible_with_immediate_abort = diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 4000f12459a90..b8407ebe869f7 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -391,6 +391,7 @@ impl CStore { flag_name, flag_name_prefixed, extern_value: extern_value.to_string(), + value_len: extern_value.len(), }) } (Some(local_value), None) => { @@ -401,6 +402,7 @@ impl CStore { flag_name, flag_name_prefixed, local_value: local_value.to_string(), + value_len: local_value.len(), }) } (None, None) => panic!("Incorrect target modifiers report_diff(None, None)"), diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 2702c4498df6f..036c7db9db28a 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -576,6 +576,7 @@ pub struct IncompatibleTargetModifiersLMissed { pub flag_name: String, pub flag_name_prefixed: String, pub extern_value: String, + pub value_len: usize, } #[derive(Diagnostic)] @@ -592,6 +593,7 @@ pub struct IncompatibleTargetModifiersRMissed { pub flag_name: String, pub flag_name_prefixed: String, pub local_value: String, + pub value_len: usize, } #[derive(Diagnostic)] diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 21fa3321a30ad..69fcf2beb687b 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -125,6 +125,20 @@ mod target_modifier_consistency_check { } true } + pub(super) fn target_cpu( + sess: &Session, + l: &TargetModifier, + r: Option<&TargetModifier>, + ) -> bool { + if sess.target.requires_explicit_and_consistent_cpu { + if let Some(r) = r { + return l.extend().tech_value == r.extend().tech_value; + } else { + return false; + } + } + true + } } impl TargetModifier { @@ -147,7 +161,11 @@ impl TargetModifier { } _ => {} }, - _ => {} + OptionsTargetModifiers::CodegenOptions(codegen) => match codegen { + CodegenOptionsTargetModifiers::target_cpu => { + return target_modifier_consistency_check::target_cpu(sess, self, other); + } + }, }; match other { Some(other) => self.extend().tech_value == other.extend().tech_value, @@ -2216,7 +2234,7 @@ options! { symbol_mangling_version: Option = (None, parse_symbol_mangling_version, [TRACKED], "which mangling version to use for symbol names ('legacy' (default), 'v0', or 'hashed')"), - target_cpu: Option = (None, parse_opt_string, [TRACKED], + target_cpu: Option = (None, parse_opt_string, [TRACKED TARGET_MODIFIER], "select target processor (`rustc --print target-cpus` for details)"), target_feature: String = (String::new(), parse_target_feature, [TRACKED], "target specific attributes. (`rustc --print target-features` for details). \ diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index 20fbb687b3080..0248d2f4c1303 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -117,7 +117,7 @@ impl Target { forward!(link_env_remove); forward!(asm_args); forward!(cpu); - forward!(need_explicit_cpu); + forward!(requires_explicit_and_consistent_cpu); forward!(features); forward!(dynamic_linking); forward_opt!(direct_access_external_data); @@ -321,7 +321,7 @@ impl ToJson for Target { target_option_val!(link_env_remove); target_option_val!(asm_args); target_option_val!(cpu); - target_option_val!(need_explicit_cpu); + target_option_val!(requires_explicit_and_consistent_cpu); target_option_val!(features); target_option_val!(dynamic_linking); target_option_val!(direct_access_external_data); @@ -544,7 +544,7 @@ struct TargetSpecJson { link_env_remove: Option]>>, asm_args: Option]>>, cpu: Option>, - need_explicit_cpu: Option, + requires_explicit_and_consistent_cpu: Option, features: Option>, dynamic_linking: Option, direct_access_external_data: Option, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 89c9fdc935cc5..1263d51fb0a8b 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2262,9 +2262,10 @@ pub struct TargetOptions { /// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults /// to "generic". pub cpu: StaticCow, - /// Whether a cpu needs to be explicitly set. - /// Set to true if there is no default cpu. Defaults to false. - pub need_explicit_cpu: bool, + /// Signals that the cpu needs to be explicitly set and be consistent when + /// multiple crates are linked together. Internally modifies `-Ctarget-cpu` + /// to act as a target modifier. Defaults to false. + pub requires_explicit_and_consistent_cpu: bool, /// Default (Rust) target features to enable for this target. These features /// overwrite `-Ctarget-cpu` but can be overwritten with `-Ctarget-features`. /// Corresponds to `llc -mattr=$llvm_features` where `$llvm_features` is the @@ -2722,7 +2723,7 @@ impl Default for TargetOptions { link_script: None, asm_args: cvs![], cpu: "generic".into(), - need_explicit_cpu: false, + requires_explicit_and_consistent_cpu: false, features: "".into(), direct_access_external_data: None, dynamic_linking: false, diff --git a/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs b/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs index 828d853ac65ec..e00321e5a0da7 100644 --- a/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs +++ b/compiler/rustc_target/src/spec/targets/amdgcn_amd_amdhsa.rs @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { // There are many CPUs, one for each hardware generation. // Require to set one explicitly as there is no good default. - need_explicit_cpu: true, + requires_explicit_and_consistent_cpu: true, max_atomic_width: Some(64), diff --git a/compiler/rustc_target/src/spec/targets/avr_none.rs b/compiler/rustc_target/src/spec/targets/avr_none.rs index eaf4e956f55ec..aacc4fc82e141 100644 --- a/compiler/rustc_target/src/spec/targets/avr_none.rs +++ b/compiler/rustc_target/src/spec/targets/avr_none.rs @@ -25,7 +25,7 @@ pub(crate) fn target() -> Target { max_atomic_width: Some(16), atomic_cas: false, relocation_model: RelocModel::Static, - need_explicit_cpu: true, + requires_explicit_and_consistent_cpu: true, ..TargetOptions::default() }, } 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 87c2693e9877f..e702ed2c13676 100644 --- a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs @@ -23,6 +23,9 @@ pub(crate) fn target() -> Target { // With `ptx-linker` approach, it can be later overridden via link flags. cpu: "sm_30".into(), + // The target cpu for NVPTX must be set manually and be consistent + // accross crates linked together. + requires_explicit_and_consistent_cpu: true, // FIXME: create tests for the atomics. max_atomic_width: Some(64), diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index 90f46b5376e01..462dfd51eb312 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -115,7 +115,6 @@ ENV TARGETS=$TARGETS,wasm32-wasip2 ENV TARGETS=$TARGETS,wasm32v1-none ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32 ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx -ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi ENV TARGETS=$TARGETS,i686-unknown-freebsd diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 9b1bf6c0df99d..eab99f9ebaf08 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -71,12 +71,6 @@ ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $ tests/assembly-llvm \ library/core -ENV NVPTX_TARGETS=nvptx64-nvidia-cuda -ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ - tests/run-make \ - tests/run-make-cargo \ - tests/assembly-llvm - ENV MUSL_TARGETS=x86_64-unknown-linux-musl \ CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \ CXX_x86_64_unknown_linux_musl=x86_64-linux-musl-g++ diff --git a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md index c722a7086967b..2e24eae8a22d9 100644 --- a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md +++ b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md @@ -30,7 +30,8 @@ It is generally necessary to specify the target, such as `-C target-cpu=sm_89`, One can use `-C target-feature=+ptx80` to choose a later PTX version without changing the target (the default in this case, `ptx78`, requires CUDA driver version 11.8, while `ptx80` would require driver version 12.0). Later PTX versions may allow more efficient code generation. -Although Rust follows LLVM in representing `ptx*` and `sm_*` as target features, they should be thought of as having crate granularity, set via (either via `-Ctarget-cpu` and optionally `-Ctarget-feature`). +For this target, the compiler enforces that all crates built into a binary use the same value for `-C target-cpu`. Therefore, it is necessary to manually build `core` every time a crate is compiled. This can be done by adding the flag `-Z build-std=core` when invoking cargo. +Although Rust follows LLVM in representing `ptx*` and `sm_*` as target features, they should also be thought of as having binary granularity. However, this is not enforced by the compiler. When building crates together, the same value for all crates should be set via `-C target-feature`. While the compiler accepts `#[target_feature(enable = "ptx80", enable = "sm_89")]`, it is not supported, may not behave as intended, and may become erroneous in the future. ## Building Rust kernels diff --git a/tests/assembly-llvm/asm/nvptx-types.rs b/tests/assembly-llvm/asm/nvptx-types.rs index 1cb176cf5148a..99646b9310b99 100644 --- a/tests/assembly-llvm/asm/nvptx-types.rs +++ b/tests/assembly-llvm/asm/nvptx-types.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: --target nvptx64-nvidia-cuda +//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@ needs-llvm-components: nvptx #![feature(no_core, asm_experimental_arch)] diff --git a/tests/assembly-llvm/auxiliary/non-inline-dependency.rs b/tests/assembly-llvm/auxiliary/non-inline-dependency.rs index 57f3ee87cdb9d..1307020b6cf61 100644 --- a/tests/assembly-llvm/auxiliary/non-inline-dependency.rs +++ b/tests/assembly-llvm/auxiliary/non-inline-dependency.rs @@ -1,14 +1,28 @@ -#![no_std] -#![deny(warnings)] +//@ add-minicore +//@ no-prefer-dynamic +//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx +#![feature(no_core, intrinsics)] +#![crate_type = "rlib"] +#![no_core] + +extern crate minicore; +use minicore::*; + +#[rustc_intrinsic] +pub const fn wrapping_mul(a: T, b: T) -> T; + +#[rustc_intrinsic] +pub const fn mul_with_overflow(x: T, y: T) -> (T, bool); #[inline(never)] #[no_mangle] pub fn wrapping_external_fn(a: u32) -> u32 { - a.wrapping_mul(a) + wrapping_mul(a, a) } #[inline(never)] #[no_mangle] -pub fn panicking_external_fn(a: u32) -> u32 { - a * a +pub fn overflowing_external_fn(a: u32) -> u32 { + mul_with_overflow(a, a).0 } diff --git a/tests/assembly-llvm/nvptx-arch-default.rs b/tests/assembly-llvm/nvptx-arch-default.rs index 22b4a680e322c..de7b23700e35e 100644 --- a/tests/assembly-llvm/nvptx-arch-default.rs +++ b/tests/assembly-llvm/nvptx-arch-default.rs @@ -1,11 +1,8 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -//@ only-nvptx64 - -#![no_std] - -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx +#![feature(no_core)] +#![no_core] // Verify default target arch with ptx-linker. // CHECK: .target sm_30 diff --git a/tests/assembly-llvm/nvptx-arch-emit-asm.rs b/tests/assembly-llvm/nvptx-arch-emit-asm.rs index e47f8e78e3679..3b1bf6ca53238 100644 --- a/tests/assembly-llvm/nvptx-arch-emit-asm.rs +++ b/tests/assembly-llvm/nvptx-arch-emit-asm.rs @@ -1,8 +1,8 @@ //@ assembly-output: emit-asm -//@ compile-flags: --crate-type rlib -//@ only-nvptx64 - -#![no_std] +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type rlib -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx +#![feature(no_core)] +#![no_core] // Verify default arch without ptx-linker involved. // CHECK: .target sm_30 diff --git a/tests/assembly-llvm/nvptx-arch-link-arg.rs b/tests/assembly-llvm/nvptx-arch-link-arg.rs index 3432e6161bf14..e2055d0d37ca6 100644 --- a/tests/assembly-llvm/nvptx-arch-link-arg.rs +++ b/tests/assembly-llvm/nvptx-arch-link-arg.rs @@ -1,5 +1,5 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60 +//@ compile-flags: --crate-type cdylib -Ctarget-cpu=sm_60 -C link-arg=--arch=sm_60 //@ only-nvptx64 //@ ignore-nvptx64 diff --git a/tests/assembly-llvm/nvptx-arch-target-cpu.rs b/tests/assembly-llvm/nvptx-arch-target-cpu.rs index e02ad0d558a96..bf794871499ce 100644 --- a/tests/assembly-llvm/nvptx-arch-target-cpu.rs +++ b/tests/assembly-llvm/nvptx-arch-target-cpu.rs @@ -1,11 +1,8 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C target-cpu=sm_50 -//@ only-nvptx64 - -#![no_std] - -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -C target-cpu=sm_50 +//@ needs-llvm-components: nvptx +#![feature(no_core)] +#![no_core] // Verify target arch override via `target-cpu`. // CHECK: .target sm_50 diff --git a/tests/assembly-llvm/nvptx-atomics.rs b/tests/assembly-llvm/nvptx-atomics.rs index 52b8c86d8a9c1..437dbe00300ad 100644 --- a/tests/assembly-llvm/nvptx-atomics.rs +++ b/tests/assembly-llvm/nvptx-atomics.rs @@ -1,5 +1,5 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib +//@ compile-flags: --crate-type cdylib -Ctarget-cpu=sm_30 //@ only-nvptx64 //@ ignore-nvptx64 diff --git a/tests/assembly-llvm/nvptx-c-abi-arg-v7.rs b/tests/assembly-llvm/nvptx-c-abi-arg-v7.rs index 6f5ef792e9b34..cfa00c2e0f5d8 100644 --- a/tests/assembly-llvm/nvptx-c-abi-arg-v7.rs +++ b/tests/assembly-llvm/nvptx-c-abi-arg-v7.rs @@ -1,6 +1,6 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 -//@ only-nvptx64 +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -C target-cpu=sm_86 +//@ needs-llvm-components: nvptx // The PTX ABI stability is tied to major versions of the PTX ISA // These tests assume major version 7 diff --git a/tests/assembly-llvm/nvptx-c-abi-ret-v7.rs b/tests/assembly-llvm/nvptx-c-abi-ret-v7.rs index 02ec9facee7a8..93951e7192aea 100644 --- a/tests/assembly-llvm/nvptx-c-abi-ret-v7.rs +++ b/tests/assembly-llvm/nvptx-c-abi-ret-v7.rs @@ -1,6 +1,6 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 -//@ only-nvptx64 +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -C target-cpu=sm_86 +//@ needs-llvm-components: nvptx // The PTX ABI stability is tied to major versions of the PTX ISA // These tests assume major version 7 diff --git a/tests/assembly-llvm/nvptx-internalizing.rs b/tests/assembly-llvm/nvptx-internalizing.rs index 0acfd5c244319..f2fc8f1173ee2 100644 --- a/tests/assembly-llvm/nvptx-internalizing.rs +++ b/tests/assembly-llvm/nvptx-internalizing.rs @@ -1,16 +1,16 @@ +//@ add-minicore //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -//@ only-nvptx64 -//@ ignore-nvptx64 +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx -#![feature(abi_ptx)] -#![no_std] +#![feature(abi_ptx, no_core, intrinsics)] +#![no_core] -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +extern crate minicore; +use minicore::*; -//@ aux-build: non-inline-dependency.rs -extern crate non_inline_dependency as dep; +#[rustc_intrinsic] +pub const unsafe fn unchecked_add(x: T, y: T) -> T; // Verify that no extra function declarations are present. // CHECK-NOT: .func @@ -19,7 +19,7 @@ extern crate non_inline_dependency as dep; #[no_mangle] pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { // CHECK: add.s32 %{{r[0-9]+}}, %{{r[0-9]+}}, 5; - *b = *a + 5; + *b = unchecked_add(*a, 5); } // Verify that no extra function definitions are here. diff --git a/tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs b/tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs index 00f6fe9332d94..1f9aac47b7654 100644 --- a/tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs +++ b/tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs @@ -1,6 +1,6 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C target-cpu=sm_86 -//@ only-nvptx64 +//@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type cdylib -C target-cpu=sm_86 +//@ needs-llvm-components: nvptx // The following ABI tests are made with nvcc 11.6 does. // diff --git a/tests/assembly-llvm/nvptx-linking-binary.rs b/tests/assembly-llvm/nvptx-linking-binary.rs index 3b50b472ab10e..a3aea32a4400a 100644 --- a/tests/assembly-llvm/nvptx-linking-binary.rs +++ b/tests/assembly-llvm/nvptx-linking-binary.rs @@ -1,21 +1,23 @@ +//@ add-minicore //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type bin +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type bin -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx //@ only-nvptx64 //@ ignore-nvptx64 -#![feature(abi_ptx)] +#![feature(abi_ptx, no_core)] #![no_main] -#![no_std] +#![no_core] -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +extern crate minicore; +use minicore::*; //@ aux-build: non-inline-dependency.rs extern crate non_inline_dependency as dep; // Make sure declarations are there. // CHECK: .func (.param .b32 func_retval0) wrapping_external_fn -// CHECK: .func (.param .b32 func_retval0) panicking_external_fn +// CHECK: .func (.param .b32 func_retval0) overflowing_external_fn // CHECK-LABEL: .visible .entry top_kernel( #[no_mangle] @@ -26,9 +28,9 @@ pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { let lhs = dep::wrapping_external_fn(*a); // CHECK: call.uni (retval0), - // CHECK-NEXT: panicking_external_fn + // CHECK-NEXT: overflowing_external_fn // CHECK: ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0]; - let rhs = dep::panicking_external_fn(*a); + let rhs = dep::overflowing_external_fn(*a); // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]]; // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]]; @@ -37,4 +39,4 @@ pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { // Verify that external function bodies are available. // CHECK: .func (.param .b32 func_retval0) wrapping_external_fn -// CHECK: .func (.param .b32 func_retval0) panicking_external_fn +// CHECK: .func (.param .b32 func_retval0) overflowing_external_fn diff --git a/tests/assembly-llvm/nvptx-linking-cdylib.rs b/tests/assembly-llvm/nvptx-linking-cdylib.rs index 9742e26fb31a9..d4a14340aafff 100644 --- a/tests/assembly-llvm/nvptx-linking-cdylib.rs +++ b/tests/assembly-llvm/nvptx-linking-cdylib.rs @@ -1,39 +1,43 @@ +//@ add-minicore //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -//@ only-nvptx64 -//@ ignore-nvptx64 +//@ compile-flags: --target nvptx64-nvidia-cuda --crate-type cdylib -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx -#![feature(abi_ptx)] -#![no_std] +#![feature(abi_ptx, no_core, intrinsics)] +#![no_main] +#![no_core] -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +extern crate minicore; +use minicore::*; //@ aux-build: non-inline-dependency.rs extern crate non_inline_dependency as dep; +#[rustc_intrinsic] +pub const unsafe fn unchecked_add(x: T, y: T) -> T; + // Make sure declarations are there. -// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn -// CHECK: .func (.param .b32 func_retval0) panicking_external_fn +// CHECK: .func (.param .{{[ubs]}}32 func_retval0) wrapping_external_fn +// CHECK: .func (.param .{{[ubs]}}32 func_retval0) overflowing_external_fn // CHECK-LABEL: .visible .entry top_kernel( #[no_mangle] pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { // CHECK: call.uni (retval0), - // CHECK-NEXT: wrapping_external_fn - // CHECK: ld.param.b32 %[[LHS:r[0-9]+]], [retval0+0]; + // CHECK: wrapping_external_fn + // CHECK: ld.param.{{[ubs]}}32 %[[LHS:r[0-9]+]], [retval0]; let lhs = dep::wrapping_external_fn(*a); // CHECK: call.uni (retval0), - // CHECK-NEXT: panicking_external_fn - // CHECK: ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0]; - let rhs = dep::panicking_external_fn(*a); + // CHECK: overflowing_external_fn + // CHECK: ld.param.{{[ubs]}}32 %[[RHS:r[0-9]+]], [retval0]; + let rhs = dep::overflowing_external_fn(*a); - // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]]; - // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]]; - *b = lhs + rhs; + // CHECK: add.{{[us]}}32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]]; + // CHECK: st.global.{{[ubs]}}32 [%{{rd[0-9]+}}], %[[RES]]; + *b = unchecked_add(lhs, rhs); } // Verify that external function bodies are available. -// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn -// CHECK: .func (.param .b32 func_retval0) panicking_external_fn +// CHECK: .func (.param .{{[ubs]}}32 func_retval0) wrapping_external_fn +// CHECK: .func (.param .{{[ubs]}}32 func_retval0) overflowing_external_fn diff --git a/tests/assembly-llvm/nvptx-safe-naming.rs b/tests/assembly-llvm/nvptx-safe-naming.rs index 85415b6ca5b5a..3b81d73c25a39 100644 --- a/tests/assembly-llvm/nvptx-safe-naming.rs +++ b/tests/assembly-llvm/nvptx-safe-naming.rs @@ -1,15 +1,19 @@ +//@ add-minicore //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -//@ only-nvptx64 +//@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type cdylib -Ctarget-cpu=sm_30 +//@ needs-llvm-components: nvptx //@ revisions: LLVM20 LLVM21 //@ [LLVM21] min-llvm-version: 21 //@ [LLVM20] max-llvm-major-version: 20 -#![feature(abi_ptx)] -#![no_std] +#![feature(abi_ptx, no_core, intrinsics)] +#![no_core] -//@ aux-build: breakpoint-panic-handler.rs -extern crate breakpoint_panic_handler; +extern crate minicore; +use minicore::*; + +#[rustc_intrinsic] +pub const fn wrapping_mul(a: T, b: T) -> T; // Verify function name doesn't contain unacceaptable characters. // CHECK: .func (.param .b32 func_retval0) [[IMPL_FN:[a-zA-Z0-9$_]+square]] @@ -25,6 +29,7 @@ pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { pub mod deep { pub mod private { + use crate::wrapping_mul; pub struct MyStruct(T); impl MyStruct { @@ -34,7 +39,7 @@ pub mod deep { #[inline(never)] pub fn square(&self) -> u32 { - self.0.wrapping_mul(self.0) + wrapping_mul(self.0, self.0) } } } diff --git a/tests/assembly-llvm/stack-protector/stack-protector-target-support.rs b/tests/assembly-llvm/stack-protector/stack-protector-target-support.rs index 9f182985d1573..7d67b3cb64bea 100644 --- a/tests/assembly-llvm/stack-protector/stack-protector-target-support.rs +++ b/tests/assembly-llvm/stack-protector/stack-protector-target-support.rs @@ -99,7 +99,7 @@ //@ [r47] needs-llvm-components: mips //@ [r48] compile-flags: --target mipsel-unknown-linux-musl //@ [r48] needs-llvm-components: mips -//@ [r49] compile-flags: --target nvptx64-nvidia-cuda +//@ [r49] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@ [r49] needs-llvm-components: nvptx //@ [r50] compile-flags: --target powerpc-unknown-linux-gnu //@ [r50] needs-llvm-components: powerpc diff --git a/tests/assembly-llvm/targets/targets-nvptx.rs b/tests/assembly-llvm/targets/targets-nvptx.rs index 69d576de696c3..3e28cc45628c1 100644 --- a/tests/assembly-llvm/targets/targets-nvptx.rs +++ b/tests/assembly-llvm/targets/targets-nvptx.rs @@ -2,7 +2,8 @@ //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: nvptx64_nvidia_cuda -//@ [nvptx64_nvidia_cuda] compile-flags: --target nvptx64-nvidia-cuda +//@ [nvptx64_nvidia_cuda] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 + //@ [nvptx64_nvidia_cuda] needs-llvm-components: nvptx // Sanity-check that each target can produce assembly code. diff --git a/tests/codegen-llvm/gpu-kernel-abi.rs b/tests/codegen-llvm/gpu-kernel-abi.rs index 828b10c37880d..9c637f0c4a2ca 100644 --- a/tests/codegen-llvm/gpu-kernel-abi.rs +++ b/tests/codegen-llvm/gpu-kernel-abi.rs @@ -4,7 +4,7 @@ //@ revisions: amdgpu nvptx //@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 //@ [amdgpu] needs-llvm-components: amdgpu -//@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda +//@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@ [nvptx] needs-llvm-components: nvptx #![feature(no_core, lang_items, abi_gpu_kernel)] #![no_core] diff --git a/tests/run-make/target-cpu-is-target-modifier/Cargo.toml b/tests/run-make/target-cpu-is-target-modifier/Cargo.toml new file mode 100644 index 0000000000000..0f9b7221be272 --- /dev/null +++ b/tests/run-make/target-cpu-is-target-modifier/Cargo.toml @@ -0,0 +1,14 @@ +# Convince cargo that this isn't part of an enclosing workspace. +[workspace] + +[package] +name = "rmake" +version = "0.1.0" +edition = "2024" + +[dependencies] +run_make_support = { path = "../../../src/tools/run-make-support" } + +[[bin]] +name = "rmake" +path = "rmake.rs" diff --git a/tests/run-make/target-cpu-is-target-modifier/dependency.rs b/tests/run-make/target-cpu-is-target-modifier/dependency.rs new file mode 100644 index 0000000000000..c12c35de302a1 --- /dev/null +++ b/tests/run-make/target-cpu-is-target-modifier/dependency.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![crate_type = "rlib"] +#![no_core] diff --git a/tests/run-make/target-cpu-is-target-modifier/incompatible_target_cpu.rs b/tests/run-make/target-cpu-is-target-modifier/incompatible_target_cpu.rs new file mode 100644 index 0000000000000..bc32fc9c304b7 --- /dev/null +++ b/tests/run-make/target-cpu-is-target-modifier/incompatible_target_cpu.rs @@ -0,0 +1,5 @@ +#![feature(no_core)] +#![crate_type = "rlib"] +#![no_core] + +extern crate dependency; diff --git a/tests/run-make/target-cpu-is-target-modifier/rmake.rs b/tests/run-make/target-cpu-is-target-modifier/rmake.rs new file mode 100644 index 0000000000000..8b41fea9cff00 --- /dev/null +++ b/tests/run-make/target-cpu-is-target-modifier/rmake.rs @@ -0,0 +1,76 @@ +use std::collections::BTreeSet; + +use run_make_support::{cwd, rustc}; + +fn main() { + let must_fail = BTreeSet::from(["avr-none", "amdgcn-amd-amdhsa", "nvptx64-nvidia-cuda"]); + let target_list = rustc().print("target-list").run().stdout_utf8(); + let targets: Vec<&str> = target_list.lines().collect(); + + // FIXME: We need to filter xtensa because of a data-layout mismatch + for target in targets.iter().filter(|&str| !str.contains("xtensa")) { + // FIXME: riscv targets list incompatible CPUs, so we hard-code the used + // target-cpus for them + let (first_target_cpu, second_target_cpu) = if target.contains("riscv32") { + ("generic-rv32".to_string(), "rocket-rv32".to_string()) + } else if target.contains("riscv64") { + ("generic-rv64".to_string(), "rocket-rv64".to_string()) + } else { + let output = rustc().target(target).print("target-cpus").run().stdout_utf8(); + let mut cpus = output + .lines() + .skip(1) + .take(3) + .filter_map(|str| str.split_whitespace().next()) + .filter(|&str| str != "native"); + ( + cpus.next() + .expect(format!("First target cpu was not found for {target}").as_str()) + .to_string(), + cpus.next() + .expect(format!("Second target cpu was not found for {target}").as_str()) + .to_string(), + ) + }; + + // Build depedency.rs with `-Ctarget-cpu specified` + let mut dep_cmd = rustc(); + dep_cmd.target(target).target_cpu(&first_target_cpu).input("dependency.rs").run(); + + if must_fail.contains(target) { + let mut allow_match = rustc(); + allow_match + .target(target) + .target_cpu(&first_target_cpu) + .input("incompatible_target_cpu.rs") + .library_search_path(cwd()) + .run(); + let mut allow_mismatch = rustc(); + allow_mismatch + .target(target) + .target_cpu(&second_target_cpu) + .arg("-Cunsafe-allow-abi-mismatch=target-cpu") + .input("incompatible_target_cpu.rs") + .library_search_path(cwd()) + .run(); + let mut error_generated = rustc(); + error_generated + .target(target) + .target_cpu(&second_target_cpu) + .input("incompatible_target_cpu.rs") + .library_search_path(cwd()) + .run_fail() + .assert_stderr_contains( + "error: mixing `-Ctarget-cpu` will cause \ + an ABI mismatch in crate `incompatible_target_cpu`", + ); + } else { + let mut cmd = rustc(); + cmd.target(target) + .target_cpu(&second_target_cpu) + .input("incompatible_target_cpu.rs") + .library_search_path(cwd()) + .run(); + } + } +} diff --git a/tests/ui/abi/cannot-be-called.rs b/tests/ui/abi/cannot-be-called.rs index 8d1a4ae0b557f..7c6e191a84ac6 100644 --- a/tests/ui/abi/cannot-be-called.rs +++ b/tests/ui/abi/cannot-be-called.rs @@ -23,7 +23,7 @@ So we test that they error in essentially all of the same places. //@ [amdgpu] needs-llvm-components: amdgpu //@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx -//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib +//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 --crate-type=rlib //@ ignore-backends: gcc #![no_core] #![feature( diff --git a/tests/ui/abi/cannot-be-coroutine.amdgpu.stderr b/tests/ui/abi/cannot-be-coroutine.amdgpu.stderr index a36ea0caa19eb..3aec8b33814df 100644 --- a/tests/ui/abi/cannot-be-coroutine.amdgpu.stderr +++ b/tests/ui/abi/cannot-be-coroutine.amdgpu.stderr @@ -11,10 +11,10 @@ LL + extern "gpu-kernel" fn async_kernel() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.avr.stderr b/tests/ui/abi/cannot-be-coroutine.avr.stderr index 643a575bece15..777b82046e66b 100644 --- a/tests/ui/abi/cannot-be-coroutine.avr.stderr +++ b/tests/ui/abi/cannot-be-coroutine.avr.stderr @@ -11,10 +11,10 @@ LL + extern "avr-interrupt" fn avr() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.i686.stderr b/tests/ui/abi/cannot-be-coroutine.i686.stderr index f618507df47d2..0db9cf86b908a 100644 --- a/tests/ui/abi/cannot-be-coroutine.i686.stderr +++ b/tests/ui/abi/cannot-be-coroutine.i686.stderr @@ -11,10 +11,10 @@ LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.msp430.stderr b/tests/ui/abi/cannot-be-coroutine.msp430.stderr index f2586c8cd9755..eba5ac212c736 100644 --- a/tests/ui/abi/cannot-be-coroutine.msp430.stderr +++ b/tests/ui/abi/cannot-be-coroutine.msp430.stderr @@ -11,10 +11,10 @@ LL + extern "msp430-interrupt" fn msp430() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.nvptx.stderr b/tests/ui/abi/cannot-be-coroutine.nvptx.stderr index a36ea0caa19eb..3aec8b33814df 100644 --- a/tests/ui/abi/cannot-be-coroutine.nvptx.stderr +++ b/tests/ui/abi/cannot-be-coroutine.nvptx.stderr @@ -11,10 +11,10 @@ LL + extern "gpu-kernel" fn async_kernel() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.riscv32.stderr b/tests/ui/abi/cannot-be-coroutine.riscv32.stderr index c5a8c3f60a382..03a96b8acc306 100644 --- a/tests/ui/abi/cannot-be-coroutine.riscv32.stderr +++ b/tests/ui/abi/cannot-be-coroutine.riscv32.stderr @@ -23,10 +23,10 @@ LL + extern "riscv-interrupt-s" fn riscv_s() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.riscv64.stderr b/tests/ui/abi/cannot-be-coroutine.riscv64.stderr index c5a8c3f60a382..03a96b8acc306 100644 --- a/tests/ui/abi/cannot-be-coroutine.riscv64.stderr +++ b/tests/ui/abi/cannot-be-coroutine.riscv64.stderr @@ -23,10 +23,10 @@ LL + extern "riscv-interrupt-s" fn riscv_s() { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.rs b/tests/ui/abi/cannot-be-coroutine.rs index 239f5aa5c31fe..9ab72a1805ccb 100644 --- a/tests/ui/abi/cannot-be-coroutine.rs +++ b/tests/ui/abi/cannot-be-coroutine.rs @@ -19,7 +19,7 @@ //@ [amdgpu] needs-llvm-components: amdgpu //@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx -//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib +//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 --crate-type=rlib //@ ignore-backends: gcc #![no_core] #![feature( @@ -35,7 +35,7 @@ extern crate minicore; use minicore::*; // We ignore this error; implementing all of the async-related lang items is not worth it. -async fn vanilla(){ +async fn vanilla() { //~^ ERROR requires `ResumeTy` lang_item } diff --git a/tests/ui/abi/cannot-be-coroutine.x64.stderr b/tests/ui/abi/cannot-be-coroutine.x64.stderr index f618507df47d2..0db9cf86b908a 100644 --- a/tests/ui/abi/cannot-be-coroutine.x64.stderr +++ b/tests/ui/abi/cannot-be-coroutine.x64.stderr @@ -11,10 +11,10 @@ LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-be-coroutine.x64_win.stderr b/tests/ui/abi/cannot-be-coroutine.x64_win.stderr index f618507df47d2..0db9cf86b908a 100644 --- a/tests/ui/abi/cannot-be-coroutine.x64_win.stderr +++ b/tests/ui/abi/cannot-be-coroutine.x64_win.stderr @@ -11,10 +11,10 @@ LL + extern "x86-interrupt" fn x86(_p: *mut ()) { | error: requires `ResumeTy` lang_item - --> $DIR/cannot-be-coroutine.rs:38:19 + --> $DIR/cannot-be-coroutine.rs:38:20 | -LL | async fn vanilla(){ - | ___________________^ +LL | async fn vanilla() { + | ____________________^ LL | | LL | | } | |_^ diff --git a/tests/ui/abi/cannot-return.rs b/tests/ui/abi/cannot-return.rs index 9a5db30431b9f..a4562c82b4082 100644 --- a/tests/ui/abi/cannot-return.rs +++ b/tests/ui/abi/cannot-return.rs @@ -6,7 +6,7 @@ //@ [amdgpu] needs-llvm-components: amdgpu //@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx -//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib +//@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 --crate-type=rlib #![no_core] #![feature(no_core, abi_gpu_kernel)] diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 84294ab343111..9d90a442848ad 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -68,7 +68,7 @@ //@[csky] compile-flags: --target csky-unknown-linux-gnuabiv2 //@[csky] needs-llvm-components: csky //@ revisions: nvptx64 -//@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda +//@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@[nvptx64] needs-llvm-components: nvptx //@ ignore-backends: gcc #![feature(no_core, rustc_attrs, lang_items)] diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index d442c9317f64e..bcd1105861124 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -3,7 +3,7 @@ //@ compile-flags: --crate-type=rlib //@[AMDGPU] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx1100 //@[AMDGPU] needs-llvm-components: amdgpu -//@[NVPTX] compile-flags: --target nvptx64-nvidia-cuda +//@[NVPTX] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@[NVPTX] needs-llvm-components: nvptx //@ ignore-backends: gcc diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.rs b/tests/ui/feature-gates/feature-gate-abi_ptx.rs index 7f5935a54683c..a1e0e708a480b 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.rs +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ needs-llvm-components: nvptx -//@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib +//@ compile-flags: --target=nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 --crate-type=rlib //@ ignore-backends: gcc #![no_core] #![feature(no_core, lang_items)] diff --git a/tests/ui/linkage-attr/unstable-flavor.rs b/tests/ui/linkage-attr/unstable-flavor.rs index 5412e248f341f..79911669ad633 100644 --- a/tests/ui/linkage-attr/unstable-flavor.rs +++ b/tests/ui/linkage-attr/unstable-flavor.rs @@ -5,7 +5,8 @@ //@ revisions: bpf ptx //@ [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib //@ [bpf] needs-llvm-components: bpf -//@ [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib +//@ [ptx] compile-flags: --target=nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 -Clinker-flavor=ptx +//@ [ptx] compile-flags: --crate-type=rlib //@ [ptx] needs-llvm-components: nvptx #![feature(no_core)] diff --git a/tests/ui/lint/lint-gpu-kernel.amdgpu.stderr b/tests/ui/lint/lint-gpu-kernel.amdgpu.stderr index 21eebe42f8b1d..42a01bd604b6b 100644 --- a/tests/ui/lint/lint-gpu-kernel.amdgpu.stderr +++ b/tests/ui/lint/lint-gpu-kernel.amdgpu.stderr @@ -1,7 +1,7 @@ warning: `extern` fn uses type `()`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:36:35 + --> $DIR/lint-gpu-kernel.rs:38:35 | -LL | extern "gpu-kernel" fn arg_zst(_: ()) { } +LL | extern "gpu-kernel" fn arg_zst(_: ()) {} | ^^ not FFI-safe | = help: consider using a struct instead @@ -9,74 +9,74 @@ LL | extern "gpu-kernel" fn arg_zst(_: ()) { } = note: `#[warn(improper_ctypes_definitions)]` on by default warning: passing type `()` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:36:35 + --> $DIR/lint-gpu-kernel.rs:38:35 | -LL | extern "gpu-kernel" fn arg_zst(_: ()) { } +LL | extern "gpu-kernel" fn arg_zst(_: ()) {} | ^^ | = help: use primitive types and raw pointers to get reliable behavior = note: `#[warn(improper_gpu_kernel_arg)]` on by default warning: passing type `&i32` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:41:35 + --> $DIR/lint-gpu-kernel.rs:43:35 | -LL | extern "gpu-kernel" fn arg_ref(_: &i32) { } +LL | extern "gpu-kernel" fn arg_ref(_: &i32) {} | ^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: passing type `&mut i32` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:44:39 + --> $DIR/lint-gpu-kernel.rs:46:39 | -LL | extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) { } +LL | extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) {} | ^^^^^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: `extern` fn uses type `S`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:49:38 + --> $DIR/lint-gpu-kernel.rs:54:38 | -LL | extern "gpu-kernel" fn arg_struct(_: S) { } +LL | extern "gpu-kernel" fn arg_struct(_: S) {} | ^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/lint-gpu-kernel.rs:47:1 + --> $DIR/lint-gpu-kernel.rs:49:1 | -LL | struct S { a: i32, b: i32 } +LL | struct S { | ^^^^^^^^ warning: passing type `S` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:49:38 + --> $DIR/lint-gpu-kernel.rs:54:38 | -LL | extern "gpu-kernel" fn arg_struct(_: S) { } +LL | extern "gpu-kernel" fn arg_struct(_: S) {} | ^ | = help: use primitive types and raw pointers to get reliable behavior warning: `extern` fn uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:54:35 + --> $DIR/lint-gpu-kernel.rs:59:35 | -LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) { } +LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) {} | ^^^^^^^^^^ not FFI-safe | = help: consider using a struct instead = note: tuples have unspecified layout warning: passing type `(i32, i32)` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:54:35 + --> $DIR/lint-gpu-kernel.rs:59:35 | -LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) { } +LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) {} | ^^^^^^^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: function with the "gpu-kernel" ABI has a mangled name - --> $DIR/lint-gpu-kernel.rs:61:1 + --> $DIR/lint-gpu-kernel.rs:66:1 | -LL | pub extern "gpu-kernel" fn mangled_kernel() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub extern "gpu-kernel" fn mangled_kernel() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use `unsafe(no_mangle)` or `unsafe(export_name = "")` = note: mangled names make it hard to find the kernel, this is usually not intended diff --git a/tests/ui/lint/lint-gpu-kernel.nvptx.stderr b/tests/ui/lint/lint-gpu-kernel.nvptx.stderr index 21eebe42f8b1d..42a01bd604b6b 100644 --- a/tests/ui/lint/lint-gpu-kernel.nvptx.stderr +++ b/tests/ui/lint/lint-gpu-kernel.nvptx.stderr @@ -1,7 +1,7 @@ warning: `extern` fn uses type `()`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:36:35 + --> $DIR/lint-gpu-kernel.rs:38:35 | -LL | extern "gpu-kernel" fn arg_zst(_: ()) { } +LL | extern "gpu-kernel" fn arg_zst(_: ()) {} | ^^ not FFI-safe | = help: consider using a struct instead @@ -9,74 +9,74 @@ LL | extern "gpu-kernel" fn arg_zst(_: ()) { } = note: `#[warn(improper_ctypes_definitions)]` on by default warning: passing type `()` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:36:35 + --> $DIR/lint-gpu-kernel.rs:38:35 | -LL | extern "gpu-kernel" fn arg_zst(_: ()) { } +LL | extern "gpu-kernel" fn arg_zst(_: ()) {} | ^^ | = help: use primitive types and raw pointers to get reliable behavior = note: `#[warn(improper_gpu_kernel_arg)]` on by default warning: passing type `&i32` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:41:35 + --> $DIR/lint-gpu-kernel.rs:43:35 | -LL | extern "gpu-kernel" fn arg_ref(_: &i32) { } +LL | extern "gpu-kernel" fn arg_ref(_: &i32) {} | ^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: passing type `&mut i32` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:44:39 + --> $DIR/lint-gpu-kernel.rs:46:39 | -LL | extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) { } +LL | extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) {} | ^^^^^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: `extern` fn uses type `S`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:49:38 + --> $DIR/lint-gpu-kernel.rs:54:38 | -LL | extern "gpu-kernel" fn arg_struct(_: S) { } +LL | extern "gpu-kernel" fn arg_struct(_: S) {} | ^ not FFI-safe | = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here - --> $DIR/lint-gpu-kernel.rs:47:1 + --> $DIR/lint-gpu-kernel.rs:49:1 | -LL | struct S { a: i32, b: i32 } +LL | struct S { | ^^^^^^^^ warning: passing type `S` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:49:38 + --> $DIR/lint-gpu-kernel.rs:54:38 | -LL | extern "gpu-kernel" fn arg_struct(_: S) { } +LL | extern "gpu-kernel" fn arg_struct(_: S) {} | ^ | = help: use primitive types and raw pointers to get reliable behavior warning: `extern` fn uses type `(i32, i32)`, which is not FFI-safe - --> $DIR/lint-gpu-kernel.rs:54:35 + --> $DIR/lint-gpu-kernel.rs:59:35 | -LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) { } +LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) {} | ^^^^^^^^^^ not FFI-safe | = help: consider using a struct instead = note: tuples have unspecified layout warning: passing type `(i32, i32)` to a function with "gpu-kernel" ABI may have unexpected behavior - --> $DIR/lint-gpu-kernel.rs:54:35 + --> $DIR/lint-gpu-kernel.rs:59:35 | -LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) { } +LL | extern "gpu-kernel" fn arg_tup(_: (i32, i32)) {} | ^^^^^^^^^^ | = help: use primitive types and raw pointers to get reliable behavior warning: function with the "gpu-kernel" ABI has a mangled name - --> $DIR/lint-gpu-kernel.rs:61:1 + --> $DIR/lint-gpu-kernel.rs:66:1 | -LL | pub extern "gpu-kernel" fn mangled_kernel() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub extern "gpu-kernel" fn mangled_kernel() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use `unsafe(no_mangle)` or `unsafe(export_name = "")` = note: mangled names make it hard to find the kernel, this is usually not intended diff --git a/tests/ui/lint/lint-gpu-kernel.rs b/tests/ui/lint/lint-gpu-kernel.rs index 9b3ed0d14d8ad..debb1e2c0619c 100644 --- a/tests/ui/lint/lint-gpu-kernel.rs +++ b/tests/ui/lint/lint-gpu-kernel.rs @@ -8,7 +8,7 @@ //@ edition: 2024 //@[amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 //@[amdgpu] needs-llvm-components: amdgpu -//@[nvptx] compile-flags: --target nvptx64-nvidia-cuda +//@[nvptx] compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@[nvptx] needs-llvm-components: nvptx #![feature(no_core, abi_gpu_kernel)] @@ -22,41 +22,46 @@ use minicore::*; #[unsafe(no_mangle)] extern "gpu-kernel" fn ret_empty() {} #[unsafe(no_mangle)] -extern "gpu-kernel" fn ret_never() -> ! { loop {} } +extern "gpu-kernel" fn ret_never() -> ! { + loop {} +} // Arguments can be scalars or pointers #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_i32(_: i32) { } +extern "gpu-kernel" fn arg_i32(_: i32) {} #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_ptr(_: *const i32) { } +extern "gpu-kernel" fn arg_ptr(_: *const i32) {} #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_ptr_mut(_: *mut i32) { } +extern "gpu-kernel" fn arg_ptr_mut(_: *mut i32) {} #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_zst(_: ()) { } +extern "gpu-kernel" fn arg_zst(_: ()) {} //~^ WARN passing type `()` to a function with "gpu-kernel" ABI may have unexpected behavior //~^^ WARN `extern` fn uses type `()`, which is not FFI-safe #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_ref(_: &i32) { } +extern "gpu-kernel" fn arg_ref(_: &i32) {} //~^ WARN passing type `&i32` to a function with "gpu-kernel" ABI may have unexpected behavior #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) { } +extern "gpu-kernel" fn arg_ref_mut(_: &mut i32) {} //~^ WARN passing type `&mut i32` to a function with "gpu-kernel" ABI may have unexpected behavior -struct S { a: i32, b: i32 } +struct S { + a: i32, + b: i32, +} #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_struct(_: S) { } +extern "gpu-kernel" fn arg_struct(_: S) {} //~^ WARN passing type `S` to a function with "gpu-kernel" ABI may have unexpected behavior //~^^ WARN `extern` fn uses type `S`, which is not FFI-safe #[unsafe(no_mangle)] -extern "gpu-kernel" fn arg_tup(_: (i32, i32)) { } +extern "gpu-kernel" fn arg_tup(_: (i32, i32)) {} //~^ WARN passing type `(i32, i32)` to a function with "gpu-kernel" ABI may have unexpected behavior //~^^ WARN `extern` fn uses type `(i32, i32)`, which is not FFI-safe #[unsafe(export_name = "kernel")] pub extern "gpu-kernel" fn allowed_kernel_name() {} -pub extern "gpu-kernel" fn mangled_kernel() { } +pub extern "gpu-kernel" fn mangled_kernel() {} //~^ WARN function with the "gpu-kernel" ABI has a mangled name diff --git a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs index 9e0e126dabe66..9e5f0d3ee3ca9 100644 --- a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs +++ b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs @@ -1,6 +1,6 @@ //@ build-pass //@ revisions: all strong basic -//@ compile-flags: --target nvptx64-nvidia-cuda +//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 //@ needs-llvm-components: nvptx //@ [all] compile-flags: -Z stack-protector=all //@ [strong] compile-flags: -Z stack-protector=strong @@ -24,7 +24,7 @@ trait Sized: MetaSized {} #[lang = "copy"] trait Copy {} -pub fn main(){} +pub fn main() {} //[all]~? WARN `-Z stack-protector=all` is not supported for target nvptx64-nvidia-cuda and will be ignored //[strong]~? WARN `-Z stack-protector=strong` is not supported for target nvptx64-nvidia-cuda and will be ignored diff --git a/tests/ui/static/static-initializer-acyclic-issue-146787.rs b/tests/ui/static/static-initializer-acyclic-issue-146787.rs index 715133bd5d3c0..6d13604a4731c 100644 --- a/tests/ui/static/static-initializer-acyclic-issue-146787.rs +++ b/tests/ui/static/static-initializer-acyclic-issue-146787.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ needs-llvm-components: nvptx -//@ compile-flags: --target nvptx64-nvidia-cuda --emit link +//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_30 --emit link //@ ignore-backends: gcc #![crate_type = "rlib"] #![feature(no_core)] diff --git a/tests/ui/target-feature/implied-features-nvptx.rs b/tests/ui/target-feature/implied-features-nvptx.rs index 1550c99f67a8d..ec65cc2c1704d 100644 --- a/tests/ui/target-feature/implied-features-nvptx.rs +++ b/tests/ui/target-feature/implied-features-nvptx.rs @@ -1,13 +1,15 @@ //@ assembly-output: ptx-linker -//@ compile-flags: --crate-type cdylib -C target-cpu=sm_80 -Z unstable-options -Clinker-flavor=llbc -//@ only-nvptx64 +//@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type cdylib -C target-cpu=sm_80 +//@ needs-llvm-components: nvptx //@ build-pass -#![no_std] +#![feature(no_core, rustc_attrs)] +#![no_core] #![allow(dead_code)] -#[panic_handler] -pub fn panic(_info: &core::panic::PanicInfo) -> ! { - loop {} +#[rustc_builtin_macro] +#[macro_export] +macro_rules! compile_error { + ($msg:expr $(,)?) => {{ /* compiler built-in */ }}; } // -Ctarget-cpu=sm_80 directly enables sm_80 and ptx70 diff --git a/tests/ui/target_modifiers/defaults_check.error.stderr b/tests/ui/target_modifiers/defaults_check.error.stderr index 644ec079ee3c7..106e64ff29356 100644 --- a/tests/ui/target_modifiers/defaults_check.error.stderr +++ b/tests/ui/target_modifiers/defaults_check.error.stderr @@ -5,7 +5,7 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zreg-struct-return=true` in this crate is incompatible with unset `-Zreg-struct-return` in dependency `default_reg_struct_return` + = note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return` being unset in dependency `default_reg_struct_return` = help: unset `-Zreg-struct-return` in this crate or set `-Zreg-struct-return=true` in `default_reg_struct_return` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error diff --git a/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr b/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr index a8c13e0ed896d..bcdee625830a7 100644 --- a/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr +++ b/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr @@ -5,8 +5,8 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `fixed_x18` - = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `fixed_x18` + = note: `-Zfixed-x18` is unset in this crate which is incompatible with `-Zfixed-x18` being set in dependency `fixed_x18` + = help: set `-Zfixed-x18` in this crate or unset `-Zfixed-x18` in `fixed_x18` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/no_value_bool.error.stderr b/tests/ui/target_modifiers/no_value_bool.error.stderr index 479f7fb47cb72..c0e3178b89cf2 100644 --- a/tests/ui/target_modifiers/no_value_bool.error.stderr +++ b/tests/ui/target_modifiers/no_value_bool.error.stderr @@ -5,7 +5,7 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zreg-struct-return` in this crate is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` + = note: `-Zreg-struct-return` is unset in this crate which is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error diff --git a/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr index 479f7fb47cb72..c0e3178b89cf2 100644 --- a/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr +++ b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr @@ -5,7 +5,7 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zreg-struct-return` in this crate is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` + = note: `-Zreg-struct-return` is unset in this crate which is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr index 1db79b025e9c9..c6abc4b574322 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr @@ -5,8 +5,8 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zsanitizer-cfi-normalize-integers` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zsanitizer-cfi-normalize-integers` in this crate is incompatible with `-Zsanitizer-cfi-normalize-integers=` in dependency `kcfi_normalize_ints` - = help: set `-Zsanitizer-cfi-normalize-integers=` in this crate or unset `-Zsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints` + = note: `-Zsanitizer-cfi-normalize-integers` is unset in this crate which is incompatible with `-Zsanitizer-cfi-normalize-integers` being set in dependency `kcfi_normalize_ints` + = help: set `-Zsanitizer-cfi-normalize-integers` in this crate or unset `-Zsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer-cfi-normalize-integers` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr index 5b949c87350b9..79e8ffbf04a5b 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr @@ -5,7 +5,7 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=kcfi` in dependency `kcfi_normalize_ints` + = note: `-Zsanitizer` is unset in this crate which is incompatible with `-Zsanitizer=kcfi` in dependency `kcfi_normalize_ints` = help: set `-Zsanitizer=kcfi` in this crate or unset `-Zsanitizer` in `kcfi_normalize_ints` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error diff --git a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr index 440a91c7707f8..cb66f56ae373f 100644 --- a/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr +++ b/tests/ui/target_modifiers/sanitizers-safestack-and-kcfi.missed_both.stderr @@ -5,7 +5,7 @@ LL | #![feature(no_core)] | ^ | = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: unset `-Zsanitizer` in this crate is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi` + = note: `-Zsanitizer` is unset in this crate which is incompatible with `-Zsanitizer=safestack,kcfi` in dependency `safestack_and_kcfi` = help: set `-Zsanitizer=safestack,kcfi` in this crate or unset `-Zsanitizer` in `safestack_and_kcfi` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error