Skip to content

Commit 951c8ac

Browse files
committed
Auto merge of #64534 - gnzlbg:uarch, r=<try>
Fix accidental stabilization in feature-detection macros This commit updates stdarch and fix the accidental stabilization of unstable target-features in the stable is_x86_feature_detected macros. For example, the "mmx" feature is unstable, but is_x86_feature_detected!("mmx") works on stable Rust.
2 parents 9150f84 + 256cd36 commit 951c8ac

File tree

74 files changed

+837
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+837
-27
lines changed

src/libstd/tests/run-time-detect.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
//! These tests just check that the macros are available in libstd.
22
3-
#![cfg_attr(
4-
any(
5-
all(target_arch = "arm", any(target_os = "linux", target_os = "android")),
6-
all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")),
7-
all(target_arch = "powerpc", target_os = "linux"),
8-
all(target_arch = "powerpc64", target_os = "linux"),
9-
),
10-
feature(stdsimd)
11-
)]
3+
#![feature(stdsimd)]
124

135
#[test]
146
#[cfg(all(target_arch = "arm",

src/stdarch

Submodule stdarch updated 50 files
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("asimd");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("crc");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("crypto");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("dotprod");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
// test for unknown features
6+
is_aarch64_feature_detected!("foobar");
7+
//~^ ERROR use of unstable library feature
8+
}
9+
10+
11+
#[cfg(not(target_arch = "aarch64"))]
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("fp");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("fp16");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("lse");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("ras");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("rcpc");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("rdm");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("sve");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("v8.1a");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("v8.2a");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("v8.3a");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("neon");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-aarch64
2+
3+
#[cfg(target_arch = "aarch64")]
4+
fn main() {
5+
is_aarch64_feature_detected!("pmull");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "aarch64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
// test for unknown features
6+
is_arm_feature_detected!("foobar");
7+
//~^ ERROR use of unstable library feature
8+
}
9+
10+
11+
#[cfg(not(target_arch = "arm"))]
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("neon");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("pmull");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("v7");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("vfp2");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("vfp3");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-arm
2+
3+
#[cfg(target_arch = "arm")]
4+
fn main() {
5+
is_arm_feature_detected!("vfp4");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "arm"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// only-mips64
2+
3+
#[cfg(target_arch = "mips64")]
4+
fn main() {
5+
// test for unknown features
6+
is_mips64_feature_detected!("foobar");
7+
//~^ ERROR use of unstable library feature
8+
}
9+
10+
11+
#[cfg(not(target_arch = "mips64"))]
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-mips64
2+
3+
#[cfg(target_arch = "mips64")]
4+
fn main() {
5+
is_mips_feature_detected!("msa");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "mips64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// only-mips
2+
3+
#[cfg(target_arch = "mips")]
4+
fn main() {
5+
// test for unknown features
6+
is_mips_feature_detected!("foobar");
7+
//~^ ERROR use of unstable library feature
8+
}
9+
10+
11+
#[cfg(not(target_arch = "mips"))]
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-mips
2+
3+
#[cfg(target_arch = "mips")]
4+
fn main() {
5+
is_mips_feature_detected!("msa");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "mips"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-powerpc64|powerpc64le
2+
3+
#[cfg(target_arch = "powerpc64")]
4+
fn main() {
5+
is_powerpc64_feature_detected!("altivec");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "powerpc64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// only-powerpc64|powerpc64le
2+
3+
#[cfg(any(target_arch = "powerpc64", target_arch = "powerpc64le"))]
4+
fn main() {
5+
// test for unknown features
6+
is_powerpc64_feature_detected!("foobar");
7+
//~^ ERROR use of unstable library feature
8+
}
9+
10+
#[cfg(any(target_arch = "powerpc64", target_arch = "powerpc64le"))]
11+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-powerpc64|powerpc64le
2+
3+
#[cfg(target_arch = "powerpc64")]
4+
fn main() {
5+
is_powerpc64_feature_detected!("power8");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "powerpc64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-powerpc64|powerpc64le
2+
3+
#[cfg(target_arch = "powerpc64")]
4+
fn main() {
5+
is_powerpc64_feature_detected!("vsx");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "powerpc64"))]
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// only-powerpc
2+
3+
#[cfg(target_arch = "powerpc")]
4+
fn main() {
5+
is_powerpc_feature_detected!("altivec");
6+
//~^ ERROR use of unstable library feature
7+
}
8+
9+
#[cfg(not(target_arch = "powerpc"))]
10+
fn main() {}

0 commit comments

Comments
 (0)