diff options
| author | varkor <github@varkor.com> | 2019-02-05 17:55:12 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-02-07 15:02:17 +0100 |
| commit | ed51b6148f4bb74fb38881b6f527f5367b5ae06f (patch) | |
| tree | 14e830c23c6aef59abacecc325a245d71e70c1ea | |
| parent | 2f73245ca460e1658b988092f5050afcbbf04501 (diff) | |
| download | rust-ed51b6148f4bb74fb38881b6f527f5367b5ae06f.tar.gz rust-ed51b6148f4bb74fb38881b6f527f5367b5ae06f.zip | |
Add test for const parameter depending on type parameter
| -rw-r--r-- | src/test/ui/const-generics/const-param-type-depends-on-type-param.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr | 21 |
2 files changed, 28 insertions, 0 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 new file mode 100644 index 00000000000..06ee523be48 --- /dev/null +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs @@ -0,0 +1,7 @@ +#![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 const generics in any position are currently unsupported + +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 new file mode 100644 index 00000000000..375c9fa5321 --- /dev/null +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr @@ -0,0 +1,21 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-param-type-depends-on-type-param.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error[E0670]: const parameters cannot depend on type parameters + --> $DIR/const-param-type-depends-on-type-param.rs:4:34 + | +LL | pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters + | ^ const parameter depends on type parameter + +error: const generics in any position are currently unsupported + --> $DIR/const-param-type-depends-on-type-param.rs:4:31 + | +LL | pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0670`. |
