From 6d7c7940b581e8a7f311327e9b48203ce97b8137 Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 25 Apr 2019 23:29:58 +0100 Subject: [PATCH] Add comment explaining restriction --- .../const-param-type-depends-on-type-param.rs | 10 ++++++++-- .../const-param-type-depends-on-type-param.stderr | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs index ca924695993..28e0d6c2bb7 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs @@ -1,7 +1,13 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -pub struct Dependent([(); 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([(); X]); +//~^ ERROR const parameters cannot depend on type parameters +//~^^ ERROR parameter `T` is never used fn main() {} diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr index 0722c2c99fe..c7dcbe13542 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr @@ -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([(); 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([(); X]); | ^ unused parameter