about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
author0yoyoyo <60439919+0yoyoyo@users.noreply.github.com>2021-05-16 23:54:14 +0900
committer0yoyoyo <60439919+0yoyoyo@users.noreply.github.com>2021-05-30 22:46:06 +0900
commit0edf4da043a1f20649cf144b98549ec38b086f49 (patch)
tree511d2e1bd6e7edb4a49e80cb85de89369e2e8182 /src/test/ui/error-codes
parent69b352ef7749825abde2d8f8e31c05f681e61a10 (diff)
downloadrust-0edf4da043a1f20649cf144b98549ec38b086f49.tar.gz
rust-0edf4da043a1f20649cf144b98549ec38b086f49.zip
Fix span of redundant generic arguments
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0107.rs26
-rw-r--r--src/test/ui/error-codes/E0107.stderr94
2 files changed, 115 insertions, 5 deletions
diff --git a/src/test/ui/error-codes/E0107.rs b/src/test/ui/error-codes/E0107.rs
index f7f6afa860e..840700c9cc6 100644
--- a/src/test/ui/error-codes/E0107.rs
+++ b/src/test/ui/error-codes/E0107.rs
@@ -1,5 +1,7 @@
 struct Foo<'a>(&'a str);
 struct Buzz<'a, 'b>(&'a str, &'b str);
+struct Qux<'a, T>(&'a T);
+struct Quux<T>(T);
 
 enum Bar {
     A,
@@ -19,6 +21,30 @@ struct Baz<'a, 'b, 'c> {
     foo2: Foo<'a, 'b, 'c>,
     //~^ ERROR this struct takes 1 lifetime argument
     //~| HELP remove these lifetime arguments
+
+    qux1: Qux<'a, 'b, i32>,
+    //~^ ERROR this struct takes 1 lifetime argument
+    //~| HELP remove this lifetime argument
+
+    qux2: Qux<'a, i32, 'b>,
+    //~^ ERROR this struct takes 1 lifetime argument
+    //~| HELP remove this lifetime argument
+
+    qux3: Qux<'a, 'b, 'c, i32>,
+    //~^ ERROR this struct takes 1 lifetime argument
+    //~| HELP remove these lifetime arguments
+
+    qux4: Qux<'a, i32, 'b, 'c>,
+    //~^ ERROR this struct takes 1 lifetime argument
+    //~| HELP remove these lifetime arguments
+
+    qux5: Qux<'a, 'b, i32, 'c>,
+    //~^ ERROR this struct takes 1 lifetime argument
+    //~| HELP remove this lifetime argument
+
+    quux: Quux<'a, i32, 'b>,
+    //~^ ERROR this struct takes 0 lifetime arguments
+    //~| HELP remove this lifetime argument
 }
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr
index 299776b08f2..3c7aa6de541 100644
--- a/src/test/ui/error-codes/E0107.stderr
+++ b/src/test/ui/error-codes/E0107.stderr
@@ -1,5 +1,5 @@
 error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
-  --> $DIR/E0107.rs:11:11
+  --> $DIR/E0107.rs:13:11
    |
 LL |     buzz: Buzz<'a>,
    |           ^^^^ -- supplied 1 lifetime argument
@@ -17,7 +17,7 @@ LL |     buzz: Buzz<'a, 'a>,
    |                  ^^^^
 
 error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
-  --> $DIR/E0107.rs:15:10
+  --> $DIR/E0107.rs:17:10
    |
 LL |     bar: Bar<'a>,
    |          ^^^---- help: remove these generics
@@ -25,13 +25,13 @@ LL |     bar: Bar<'a>,
    |          expected 0 lifetime arguments
    |
 note: enum defined here, with 0 lifetime parameters
-  --> $DIR/E0107.rs:4:6
+  --> $DIR/E0107.rs:6:6
    |
 LL | enum Bar {
    |      ^^^
 
 error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
-  --> $DIR/E0107.rs:19:11
+  --> $DIR/E0107.rs:21:11
    |
 LL |     foo2: Foo<'a, 'b, 'c>,
    |           ^^^     ------ help: remove these lifetime arguments
@@ -44,6 +44,90 @@ note: struct defined here, with 1 lifetime parameter: `'a`
 LL | struct Foo<'a>(&'a str);
    |        ^^^ --
 
-error: aborting due to 3 previous errors
+error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
+  --> $DIR/E0107.rs:25:11
+   |
+LL |     qux1: Qux<'a, 'b, i32>,
+   |           ^^^     -- help: remove this lifetime argument
+   |           |
+   |           expected 1 lifetime argument
+   |
+note: struct defined here, with 1 lifetime parameter: `'a`
+  --> $DIR/E0107.rs:3:8
+   |
+LL | struct Qux<'a, T>(&'a T);
+   |        ^^^ --
+
+error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
+  --> $DIR/E0107.rs:29:11
+   |
+LL |     qux2: Qux<'a, i32, 'b>,
+   |           ^^^          -- help: remove this lifetime argument
+   |           |
+   |           expected 1 lifetime argument
+   |
+note: struct defined here, with 1 lifetime parameter: `'a`
+  --> $DIR/E0107.rs:3:8
+   |
+LL | struct Qux<'a, T>(&'a T);
+   |        ^^^ --
+
+error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+  --> $DIR/E0107.rs:33:11
+   |
+LL |     qux3: Qux<'a, 'b, 'c, i32>,
+   |           ^^^     ------ help: remove these lifetime arguments
+   |           |
+   |           expected 1 lifetime argument
+   |
+note: struct defined here, with 1 lifetime parameter: `'a`
+  --> $DIR/E0107.rs:3:8
+   |
+LL | struct Qux<'a, T>(&'a T);
+   |        ^^^ --
+
+error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+  --> $DIR/E0107.rs:37:11
+   |
+LL |     qux4: Qux<'a, i32, 'b, 'c>,
+   |           ^^^          ------ help: remove these lifetime arguments
+   |           |
+   |           expected 1 lifetime argument
+   |
+note: struct defined here, with 1 lifetime parameter: `'a`
+  --> $DIR/E0107.rs:3:8
+   |
+LL | struct Qux<'a, T>(&'a T);
+   |        ^^^ --
+
+error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
+  --> $DIR/E0107.rs:41:11
+   |
+LL |     qux5: Qux<'a, 'b, i32, 'c>,
+   |           ^^^     -- help: remove this lifetime argument
+   |           |
+   |           expected 1 lifetime argument
+   |
+note: struct defined here, with 1 lifetime parameter: `'a`
+  --> $DIR/E0107.rs:3:8
+   |
+LL | struct Qux<'a, T>(&'a T);
+   |        ^^^ --
+
+error[E0107]: this struct takes 0 lifetime arguments but 2 lifetime arguments were supplied
+  --> $DIR/E0107.rs:45:11
+   |
+LL |     quux: Quux<'a, i32, 'b>,
+   |           ^^^^ -- help: remove this lifetime argument
+   |           |
+   |           expected 0 lifetime arguments
+   |
+note: struct defined here, with 0 lifetime parameters
+  --> $DIR/E0107.rs:4:8
+   |
+LL | struct Quux<T>(T);
+   |        ^^^^
+
+error: aborting due to 9 previous errors
 
 For more information about this error, try `rustc --explain E0107`.