diff options
| author | Jens Reidel <adrian@travitia.xyz> | 2025-07-18 18:55:33 +0200 |
|---|---|---|
| committer | Jens Reidel <adrian@travitia.xyz> | 2025-07-18 19:00:52 +0200 |
| commit | 1b35d5f89c4e3c605cd455a28f00aad24de0a662 (patch) | |
| tree | e2ac178d441393202001feae4020fd39ffd65748 /tests/ui/cfg | |
| parent | 664d742933e020f70032e0fd8cd9c8869848fd4f (diff) | |
| download | rust-1b35d5f89c4e3c605cd455a28f00aad24de0a662.tar.gz rust-1b35d5f89c4e3c605cd455a28f00aad24de0a662.zip | |
tests: Add a regression test for crt-static with target features
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Diffstat (limited to 'tests/ui/cfg')
| -rw-r--r-- | tests/ui/cfg/crt-static-with-target-features-works.rs | 24 | ||||
| -rw-r--r-- | tests/ui/cfg/crt-static-with-target-features-works.stderr | 8 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/cfg/crt-static-with-target-features-works.rs b/tests/ui/cfg/crt-static-with-target-features-works.rs new file mode 100644 index 00000000000..bce02229624 --- /dev/null +++ b/tests/ui/cfg/crt-static-with-target-features-works.rs @@ -0,0 +1,24 @@ +// Test to ensure that specifying a value for crt-static in target features +// does not result in skipping the features following it. +// This is a regression test for #144143 + +//@ add-core-stubs +//@ needs-llvm-components: x86 +//@ compile-flags: --target=x86_64-unknown-linux-gnu +//@ compile-flags: -Ctarget-feature=+crt-static,+avx2 + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] + +extern crate minicore; +use minicore::*; + +#[rustc_builtin_macro] +macro_rules! compile_error { + () => {}; +} + +#[cfg(target_feature = "avx2")] +compile_error!("+avx2"); +//~^ ERROR: +avx2 diff --git a/tests/ui/cfg/crt-static-with-target-features-works.stderr b/tests/ui/cfg/crt-static-with-target-features-works.stderr new file mode 100644 index 00000000000..6f265c685bb --- /dev/null +++ b/tests/ui/cfg/crt-static-with-target-features-works.stderr @@ -0,0 +1,8 @@ +error: +avx2 + --> $DIR/crt-static-with-target-features-works.rs:23:1 + | +LL | compile_error!("+avx2"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + |
