Skip to content

Commit 4582e35

Browse files
committed
Add kl and widekl target features, and the feature gate
1 parent 207ed1b commit 4582e35

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

compiler/rustc_feature/src/unstable.rs

+2
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@ declare_features! (
525525
(unstable, inline_const_pat, "1.58.0", Some(76001)),
526526
/// Allows using `pointer` and `reference` in intra-doc links
527527
(unstable, intra_doc_pointers, "1.51.0", Some(80896)),
528+
// Allows using the `kl` and `widekl` target features and the associated intrinsics
529+
(unstable, keylocker_x86, "CURRENT_RUSTC_VERSION", Some(134813)),
528530
// Allows setting the threshold for the `large_assignments` lint.
529531
(unstable, large_assignments, "1.52.0", Some(83518)),
530532
/// Allow to have type alias types for inter-crate use.

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ symbols! {
11481148
iterator,
11491149
iterator_collect_fn,
11501150
kcfi,
1151+
keylocker_x86,
11511152
keyword,
11521153
kind,
11531154
kreg,

compiler/rustc_target/src/target_features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ const X86_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
508508
("fma", STABLE, &["avx"]),
509509
("fxsr", STABLE, &[]),
510510
("gfni", unstable(sym::avx512_target_feature), &["sse2"]),
511+
("kl", unstable(sym::keylocker_x86), &["sse2"]),
512+
("widekl", unstable(sym::keylocker_x86), &["kl"]),
511513
("lahfsahf", unstable(sym::lahfsahf_target_feature), &[]),
512514
("lzcnt", STABLE, &[]),
513515
("movbe", STABLE, &[]),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//@ only-x86_64
2+
#[target_feature(enable = "kl")]
3+
//~^ ERROR: currently unstable
4+
unsafe fn foo() {}
5+
6+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
rror[E0658]: the target feature `kl` is currently unstable
2+
--> $DIR/feature-gate-keylocker_x86.rs:2:18
3+
|
4+
LL | #[target_feature(enable = "kl")]
5+
| ^^^^^^^^^^^^^
6+
|
7+
= note: see issue #134813 <https://github.com/rust-lang/rust/issues/134813> for more information
8+
= help: add `#![feature(keylocker_x86)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)