diff options
| author | varkor <github@varkor.com> | 2019-05-04 14:38:10 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-05-04 22:28:08 +0100 |
| commit | 3e6787cb4cadc036cab3dfee5f7e25f553e6ab24 (patch) | |
| tree | 02b02d38c64d4ee6da9ddfd662035076c1faf46f /src/test/ui | |
| parent | 47f373128a9727f299b3ae53cbf7d26da74abc75 (diff) | |
| download | rust-3e6787cb4cadc036cab3dfee5f7e25f553e6ab24.tar.gz rust-3e6787cb4cadc036cab3dfee5f7e25f553e6ab24.zip | |
Early error for mixing order of const and type parameters
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/const-generics/const-param-before-other-params.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/const-generics/const-param-before-other-params.stderr | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index 188b5dce31e..2c81681b85e 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,12 +1,12 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn foo<const X: (), T>(_: &T) { - //~^ ERROR type parameters must be declared prior to const parameters -} - fn bar<const X: (), 'a>(_: &'a ()) { //~^ ERROR lifetime parameters must be declared prior to const parameters } +fn foo<const X: (), T>(_: &T) { + //~^ ERROR type parameters must be declared prior to const parameters +} + fn main() {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index 78f129e79ea..33f981d1eba 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -4,17 +4,17 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error: type parameters must be declared prior to const parameters +error: lifetime parameters must be declared prior to const parameters --> $DIR/const-param-before-other-params.rs:4:21 | -LL | fn foo<const X: (), T>(_: &T) { - | --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>` +LL | fn bar<const X: (), 'a>(_: &'a ()) { + | --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` -error: lifetime parameters must be declared prior to const parameters +error: type parameters must be declared prior to const parameters --> $DIR/const-param-before-other-params.rs:8:21 | -LL | fn bar<const X: (), 'a>(_: &'a ()) { - | --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` +LL | fn foo<const X: (), T>(_: &T) { + | --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>` error: aborting due to 2 previous errors |
