Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 28b752a

Browse files
committedNov 23, 2023
Add feature gate for Scalable SIMD types
1 parent 4c14a6d commit 28b752a

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed
 

‎compiler/rustc_ast_passes/src/feature_gate.rs

+9
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
261261
"SIMD types are experimental and possibly buggy"
262262
);
263263
}
264+
265+
if item.has_name(sym::scalable) {
266+
gate!(
267+
&self,
268+
repr_scalable,
269+
attr.span,
270+
"Scalable SIMD types are experimental and possibly buggy"
271+
);
272+
}
264273
}
265274
}
266275
}

‎compiler/rustc_feature/src/unstable.rs

+2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ declare_features! (
199199
(internal, prelude_import, "1.2.0", None, None),
200200
/// Used to identify crates that contain the profiler runtime.
201201
(internal, profiler_runtime, "1.18.0", None, None),
202+
/// Allows the use of scalable SIMD types.
203+
(unstable, repr_scalable, "CURRENT_RUSTC_VERSION", None, None),
202204
/// Allows using `rustc_*` attributes (RFC 572).
203205
(internal, rustc_attrs, "1.0.0", None, None),
204206
/// Allows using the `#[stable]` and `#[unstable]` attributes.
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() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)
Please sign in to comment.