diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-09 22:26:49 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-16 11:13:05 +0200 |
| commit | 6f5d8bf5c8ec9a62d62623e59fceb8abd0996f1b (patch) | |
| tree | c5c47e31f3e136ec44f5c95e0a21a558da010dae /src/test/ui/const-generics | |
| parent | 3f558402431f4ce033fb472bdd9cc10bd92fa73a (diff) | |
| download | rust-6f5d8bf5c8ec9a62d62623e59fceb8abd0996f1b.tar.gz rust-6f5d8bf5c8ec9a62d62623e59fceb8abd0996f1b.zip | |
don't supply generics to AnonConsts in param lists
Diffstat (limited to 'src/test/ui/const-generics')
3 files changed, 12 insertions, 32 deletions
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 9aae73ca4b0..5aa3617d1d7 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 @@ -8,10 +8,8 @@ pub struct Dependent<const N: usize, const X: [u8; N]>([(); 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<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() {} 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 22e55975dcd..a06bdea1b3c 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,8 +4,8 @@ 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 +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:12:40 | LL | pub struct SelfDependent<const N: [u8; N]>; | ^ const parameters must have a concrete type @@ -19,32 +19,5 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -error[E0391]: cycle detected when computing type of `Dependent::X` - --> $DIR/const-param-type-depends-on-const-param.rs:9:44 - | -LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]); - | ^ - | - = note: ...which again requires computing type of `Dependent::X`, completing the cycle -note: cycle used when computing type of `Dependent` - --> $DIR/const-param-type-depends-on-const-param.rs:9:1 - | -LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -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 +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/const-generics/issues/issue-74101.rs b/src/test/ui/const-generics/issues/issue-74101.rs new file mode 100644 index 00000000000..2f427ef3a27 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-74101.rs @@ -0,0 +1,9 @@ +// check-pass +#![feature(const_generics)] +#![allow(incomplete_features)] + +fn test<const N: [u8; 1 + 2]>() {} + +struct Foo<const N: [u8; 1 + 2]>; + +fn main() {} |
