Skip to content

Commit ed51b61

Browse files
committed
Add test for const parameter depending on type parameter
1 parent 2f73245 commit ed51b61

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(const_generics)]
2+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
3+
4+
pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
5+
//~^ ERROR const generics in any position are currently unsupported
6+
7+
fn main() {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/const-param-type-depends-on-type-param.rs:1:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error[E0670]: const parameters cannot depend on type parameters
8+
--> $DIR/const-param-type-depends-on-type-param.rs:4:34
9+
|
10+
LL | pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
11+
| ^ const parameter depends on type parameter
12+
13+
error: const generics in any position are currently unsupported
14+
--> $DIR/const-param-type-depends-on-type-param.rs:4:31
15+
|
16+
LL | pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
17+
| ^
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0670`.

0 commit comments

Comments
 (0)