Add comment explaining restriction
This commit is contained in:
parent
8f78736fee
commit
6d7c7940b5
@ -1,7 +1,13 @@
|
||||
#![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
|
||||
// Currently, const parameters cannot depend on type parameters, because there is no way to
|
||||
// enforce the `structural_match` property on an arbitrary type parameter. This restriction
|
||||
// may be relaxed in the future. See https://github.com/rust-lang/rfcs/pull/2000 for more
|
||||
// details.
|
||||
|
||||
pub struct Dependent<T, const X: T>([(); X]);
|
||||
//~^ ERROR const parameters cannot depend on type parameters
|
||||
//~^^ ERROR parameter `T` is never used
|
||||
|
||||
fn main() {}
|
||||
|
@ -5,13 +5,13 @@ LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0671]: const parameters cannot depend on type parameters
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:4:34
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:9: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
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:9:22
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
| ^ unused parameter
|
||||
|
Loading…
Reference in New Issue
Block a user