tests: Add a regression test for crt-static with target features
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
(cherry picked from commit 1b35d5f89c)
This commit is contained in:
parent
8791ef8a2a
commit
3df07a67c1
2 changed files with 32 additions and 0 deletions
24
tests/ui/cfg/crt-static-with-target-features-works.rs
Normal file
24
tests/ui/cfg/crt-static-with-target-features-works.rs
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue