Skip to content

Commit 1d5a32f

Browse files
committed
Add feature gate for Scalable SIMD types
1 parent ea49987 commit 1d5a32f

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
251251
"SIMD types are experimental and possibly buggy"
252252
);
253253
}
254+
255+
if item.has_name(sym::scalable) {
256+
gate!(
257+
&self,
258+
repr_scalable,
259+
attr.span,
260+
"Scalable SIMD types are experimental and possibly buggy"
261+
);
262+
}
254263
}
255264
}
256265
}

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ declare_features! (
219219
(internal, prelude_import, "1.2.0", None),
220220
/// Used to identify crates that contain the profiler runtime.
221221
(internal, profiler_runtime, "1.18.0", None),
222+
/// Allows the use of scalable SIMD types.
223+
(unstable, repr_scalable, "CURRENT_RUSTC_VERSION", None),
222224
/// Allows using `rustc_*` attributes (RFC 572).
223225
(internal, rustc_attrs, "1.0.0", None),
224226
/// Allows using the `#[stable]` and `#[unstable]` attributes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(repr_simd)]
2+
3+
#[repr(simd, scalable(16))] //~ error: Scalable SIMD types are experimental
4+
struct Foo {
5+
_ty: [i8; 0],
6+
}
7+
8+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0658]: Scalable SIMD types are experimental and possibly buggy
2+
--> $DIR/feature-gate-repr-scalable.rs:3:1
3+
|
4+
LL | #[repr(simd, scalable(16))]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add `#![feature(repr_scalable)]` to the crate attributes to enable
8+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)