diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs b/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs index 6eb13c38e02..9aae73ca4b0 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs +++ b/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs @@ -10,4 +10,8 @@ pub struct Dependent([(); N]); //~^ ERROR: the type of const parameters must not depend on other generic parameters //~| ERROR: cycle detected when computing type of `Dependent::X` +pub struct SelfDependent; +//~^ ERROR: the type of const parameters must not depend on other generic parameters +//~| ERROR: cycle detected when computing type of `SelfDependent::N` + fn main() {} diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr index 63416732bf4..22e55975dcd 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr +++ b/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr @@ -4,6 +4,12 @@ error[E0770]: the type of const parameters must not depend on other generic para LL | pub struct Dependent([(); N]); | ^ const parameters must have a concrete type +error[E0769]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:13:40 + | +LL | pub struct SelfDependent; + | ^ const parameters must have a concrete type + warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/const-param-type-depends-on-const-param.rs:1:12 | @@ -26,6 +32,19 @@ note: cycle used when computing type of `Dependent` LL | pub struct Dependent([(); N]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error[E0391]: cycle detected when computing type of `SelfDependent::N` + --> $DIR/const-param-type-depends-on-const-param.rs:13:32 + | +LL | pub struct SelfDependent; + | ^ + | + = note: ...which again requires computing type of `SelfDependent::N`, completing the cycle +note: cycle used when computing type of `SelfDependent` + --> $DIR/const-param-type-depends-on-const-param.rs:13:1 + | +LL | pub struct SelfDependent; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0391`.