mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
add self dependent const param test
This commit is contained in:
@@ -10,4 +10,8 @@
|
||||
//~^ 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<const N: [u8; N]>;
|
||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||
//~| ERROR: cycle detected when computing type of `SelfDependent::N`
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -4,6 +4,12 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); 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 N: [u8; N]>;
|
||||
| ^ 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<const N: usize, const X: [u8; N]>([(); 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<const N: [u8; N]>;
|
||||
| ^
|
||||
|
|
||||
= 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<const N: [u8; N]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0391`.
|
||||
|
||||
Reference in New Issue
Block a user