about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-23 13:19:35 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-07-23 13:19:35 +0200
commit9910f156df7a17cbbdf319790ce005487d66d2fd (patch)
tree9ee88113ce132ce10d656556cf47bf0e50d9e9a4 /src/test
parent6dc6a1f9472d7e4be430368dad79a9f8a34c8de0 (diff)
downloadrust-9910f156df7a17cbbdf319790ce005487d66d2fd.tar.gz
rust-9910f156df7a17cbbdf319790ce005487d66d2fd.zip
add more complex param order test
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/argument_order.rs7
-rw-r--r--src/test/ui/const-generics/argument_order.stderr14
2 files changed, 20 insertions, 1 deletions
diff --git a/src/test/ui/const-generics/argument_order.rs b/src/test/ui/const-generics/argument_order.rs
index 6110d16c070..9a9b7986c9c 100644
--- a/src/test/ui/const-generics/argument_order.rs
+++ b/src/test/ui/const-generics/argument_order.rs
@@ -6,4 +6,11 @@ struct Bad<const N: usize, T> { //~ ERROR type parameters must be declared prior
     another: T,
 }
 
+struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
+    //~^ ERROR type parameters must be declared prior
+    //~| ERROR lifetime parameters must be declared prior
+    a: &'a T,
+    b: &'b U,
+}
+
 fn main() { }
diff --git a/src/test/ui/const-generics/argument_order.stderr b/src/test/ui/const-generics/argument_order.stderr
index f77ae49cf10..bc2be3b8f10 100644
--- a/src/test/ui/const-generics/argument_order.stderr
+++ b/src/test/ui/const-generics/argument_order.stderr
@@ -4,6 +4,18 @@ error: type parameters must be declared prior to const parameters
 LL | struct Bad<const N: usize, T> {
    |           -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
 
+error: lifetime parameters must be declared prior to const parameters
+  --> $DIR/argument_order.rs:9:32
+   |
+LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
+   |               -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
+
+error: type parameters must be declared prior to const parameters
+  --> $DIR/argument_order.rs:9:36
+   |
+LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
+   |               ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
+
 warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
   --> $DIR/argument_order.rs:1:12
    |
@@ -13,5 +25,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: aborting due to previous error; 1 warning emitted
+error: aborting due to 3 previous errors; 1 warning emitted