From 972cf3554f35f86aa29324db124a96b9b321762d Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 8 May 2025 01:06:23 +0530 Subject: [PATCH 1/2] Stabilize the `keylocker_x86` flag, and the `kl` and `widekl` target features --- compiler/rustc_feature/src/accepted.rs | 2 ++ compiler/rustc_feature/src/unstable.rs | 2 -- compiler/rustc_target/src/target_features.rs | 4 ++-- library/core/src/lib.rs | 2 +- .../ui/feature-gates/feature-gate-keylocker_x86.rs | 6 ------ .../feature-gates/feature-gate-keylocker_x86.stderr | 13 ------------- 6 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 tests/ui/feature-gates/feature-gate-keylocker_x86.rs delete mode 100644 tests/ui/feature-gates/feature-gate-keylocker_x86.stderr diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index e3e4eefe5e10a..f6d721be1d929 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -257,6 +257,8 @@ declare_features! ( /// Allows some increased flexibility in the name resolution rules, /// especially around globs and shadowing (RFC 1560). (accepted, item_like_imports, "1.15.0", Some(35120)), + // Allows using the `kl` and `widekl` target features and the associated intrinsics + (accepted, keylocker_x86, "1.86.0", Some(134813)), /// Allows `'a: { break 'a; }`. (accepted, label_break_value, "1.65.0", Some(48594)), /// Allows `let...else` statements. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index a5f89b7a076ae..74f81da18b84f 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -545,8 +545,6 @@ declare_features! ( (incomplete, inherent_associated_types, "1.52.0", Some(8995)), /// Allows using `pointer` and `reference` in intra-doc links (unstable, intra_doc_pointers, "1.51.0", Some(80896)), - // Allows using the `kl` and `widekl` target features and the associated intrinsics - (unstable, keylocker_x86, "1.86.0", Some(134813)), // Allows setting the threshold for the `large_assignments` lint. (unstable, large_assignments, "1.52.0", Some(83518)), /// Allow to have type alias types for inter-crate use. diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 5a21925ba04e7..64ecdfa30e4ca 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -443,7 +443,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ("fma", Stable, &["avx"]), ("fxsr", Stable, &[]), ("gfni", Unstable(sym::avx512_target_feature), &["sse2"]), - ("kl", Unstable(sym::keylocker_x86), &["sse2"]), + ("kl", Stable, &["sse2"]), ("lahfsahf", Unstable(sym::lahfsahf_target_feature), &[]), ("lzcnt", Stable, &[]), ("movbe", Stable, &[]), @@ -471,7 +471,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ("tbm", Unstable(sym::tbm_target_feature), &[]), ("vaes", Unstable(sym::avx512_target_feature), &["avx2", "aes"]), ("vpclmulqdq", Unstable(sym::avx512_target_feature), &["avx", "pclmulqdq"]), - ("widekl", Unstable(sym::keylocker_x86), &["kl"]), + ("widekl", Stable, &["kl"]), ("x87", Unstable(sym::x87_target_feature), &[]), ("xop", Unstable(sym::xop_target_feature), &[/*"fma4", */ "avx", "sse4a"]), ("xsave", Stable, &[]), diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 64a7ec8906b6b..eb2bd24ade645 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -188,11 +188,11 @@ // // Target features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(keylocker_x86))] #![feature(aarch64_unstable_target_feature)] #![feature(arm_target_feature)] #![feature(avx512_target_feature)] #![feature(hexagon_target_feature)] -#![feature(keylocker_x86)] #![feature(loongarch_target_feature)] #![feature(mips_target_feature)] #![feature(powerpc_target_feature)] diff --git a/tests/ui/feature-gates/feature-gate-keylocker_x86.rs b/tests/ui/feature-gates/feature-gate-keylocker_x86.rs deleted file mode 100644 index cef80ad41a892..0000000000000 --- a/tests/ui/feature-gates/feature-gate-keylocker_x86.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ only-x86_64 -#[target_feature(enable = "kl")] -//~^ ERROR: currently unstable -unsafe fn foo() {} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr b/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr deleted file mode 100644 index ed814d3a3ce2e..0000000000000 --- a/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: the target feature `kl` is currently unstable - --> $DIR/feature-gate-keylocker_x86.rs:2:18 - | -LL | #[target_feature(enable = "kl")] - | ^^^^^^^^^^^^^ - | - = note: see issue #134813 for more information - = help: add `#![feature(keylocker_x86)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. From 820d7b996f357c8db183b4d4f4047b74c0fa2a03 Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 8 May 2025 01:04:23 +0530 Subject: [PATCH 2/2] [DO NOT MERGE] Update stdarch to stabilize the intrinsics and runtime detection for keylocker --- .gitmodules | 2 +- library/stdarch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d09d81ccadcb0..4ebcae3c3c51f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,7 +20,7 @@ shallow = true [submodule "library/stdarch"] path = library/stdarch - url = https://github.com/rust-lang/stdarch.git + url = https://github.com/sayantn/stdarch.git shallow = true [submodule "src/doc/edition-guide"] path = src/doc/edition-guide diff --git a/library/stdarch b/library/stdarch index f1c1839c0deb9..65ab96028172a 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit f1c1839c0deb985a9f98cbd6b38a6d43f2df6157 +Subproject commit 65ab96028172a6ad9d38200b08df794fcfdd6120