Skip to content

Commit

Permalink
Add a test for const parameters with type parameters as types
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Apr 25, 2019
1 parent 102f7a8 commit 908a639
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash

pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
//~^ ERROR parameter `T` is never used

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-param-type-depends-on-type-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^

error[E0671]: const parameters cannot depend on type parameters
--> $DIR/const-param-type-depends-on-type-param.rs:4:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ const parameter depends on type parameter

error[E0392]: parameter `T` is never used
--> $DIR/const-param-type-depends-on-type-param.rs:4:22
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0392, E0671.
For more information about an error, try `rustc --explain E0392`.

0 comments on commit 908a639

Please sign in to comment.