Skip to content

Commit 8fd5979

Browse files
varkoryodaldevoid
andcommitted
Add const generics feature gate test
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
1 parent 3991ba7 commit 8fd5979

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn foo<const X: ()>() {} //~ ERROR const generics are unstable
2+
//~^ const generics in any position are currently unsupported
3+
4+
struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
5+
6+
fn main() {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0658]: const generics are unstable (see issue #44580)
2+
--> $DIR/feature-gate-const_generics.rs:1:14
3+
|
4+
LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
5+
| ^
6+
|
7+
= help: add #![feature(const_generics)] to the crate attributes to enable
8+
9+
error[E0658]: const generics are unstable (see issue #44580)
10+
--> $DIR/feature-gate-const_generics.rs:4:18
11+
|
12+
LL | struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
13+
| ^
14+
|
15+
= help: add #![feature(const_generics)] to the crate attributes to enable
16+
17+
error: const generics in any position are currently unsupported
18+
--> $DIR/feature-gate-const_generics.rs:1:14
19+
|
20+
LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
21+
| ^
22+
23+
error: aborting due to 3 previous errors
24+
25+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)