diff options
| author | Patryk Wychowaniec <pwychowaniec@pm.me> | 2021-01-02 19:45:11 +0100 |
|---|---|---|
| committer | Patryk Wychowaniec <pwychowaniec@pm.me> | 2021-01-10 13:07:40 +0100 |
| commit | d2f8e398f19b5b3d38646328ec158f50db6b8b06 (patch) | |
| tree | 2bda5bffd2730c12e6d4a0104ec720f76f17a9ae /src/test/ui/methods | |
| parent | 34628e5b533d35840b61c5db0665cf7633ed3c5a (diff) | |
| download | rust-d2f8e398f19b5b3d38646328ec158f50db6b8b06.tar.gz rust-d2f8e398f19b5b3d38646328ec158f50db6b8b06.zip | |
Rework diagnostics for wrong number of generic args
Diffstat (limited to 'src/test/ui/methods')
| -rw-r--r-- | src/test/ui/methods/method-call-lifetime-args-fail.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/methods/method-call-lifetime-args-fail.stderr | 120 |
2 files changed, 86 insertions, 44 deletions
diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.rs b/src/test/ui/methods/method-call-lifetime-args-fail.rs index 938a7f5575e..8a840ba62cc 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-fail.rs @@ -1,3 +1,5 @@ +// ignore-tidy-linelength + struct S; impl S { @@ -14,9 +16,9 @@ impl S { fn method_call() { S.early(); // OK S.early::<'static>(); - //~^ ERROR wrong number of lifetime arguments: expected 2, found 1 + //~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied S.early::<'static, 'static, 'static>(); - //~^ ERROR wrong number of lifetime arguments: expected 2, found 3 + //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S.life_and_type::<'static>(); S.life_and_type::<u8>(); S.life_and_type::<'static, u8>(); @@ -61,9 +63,9 @@ fn ufcs() { S::early(S); // OK S::early::<'static>(S); - //~^ ERROR wrong number of lifetime arguments: expected 2, found 1 + //~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied S::early::<'static, 'static, 'static>(S); - //~^ ERROR wrong number of lifetime arguments: expected 2, found 3 + //~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied let _: &u8 = S::life_and_type::<'static>(S); S::life_and_type::<u8>(S); S::life_and_type::<'static, u8>(S); diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-fail.stderr index 74dab5f4400..34a2e3dec2e 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-fail.stderr @@ -1,194 +1,234 @@ -error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/method-call-lifetime-args-fail.rs:16:7 +error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied + --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static>(); - | ^^^^^ expected 2 lifetime arguments + | ^^^^^ ------- supplied 1 lifetime argument + | | + | expected 2 lifetime arguments + | +note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` + --> $DIR/method-call-lifetime-args-fail.rs:8:8 + | +LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } + | ^^^^^ -- -- +help: add missing lifetime argument + | +LL | S.early::<'static, 'b>(); + | ^^^^ -error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/method-call-lifetime-args-fail.rs:18:33 +error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied + --> $DIR/method-call-lifetime-args-fail.rs:20:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^^^ unexpected lifetime argument + | ^^^^^ --------- help: remove this lifetime argument + | | + | expected 2 lifetime arguments + | +note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` + --> $DIR/method-call-lifetime-args-fail.rs:8:8 + | +LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } + | ^^^^^ -- -- error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:27:15 + --> $DIR/method-call-lifetime-args-fail.rs:29:15 | LL | S::late::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:4:13 + --> $DIR/method-call-lifetime-args-fail.rs:6:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:29:15 + --> $DIR/method-call-lifetime-args-fail.rs:31:15 | LL | S::late::<'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:4:13 + --> $DIR/method-call-lifetime-args-fail.rs:6:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:31:15 + --> $DIR/method-call-lifetime-args-fail.rs:33:15 | LL | S::late::<'static, 'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:4:13 + --> $DIR/method-call-lifetime-args-fail.rs:6:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:34:21 + --> $DIR/method-call-lifetime-args-fail.rs:36:21 | LL | S::late_early::<'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:7:19 + --> $DIR/method-call-lifetime-args-fail.rs:9:19 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:36:21 + --> $DIR/method-call-lifetime-args-fail.rs:38:21 | LL | S::late_early::<'static, 'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:7:19 + --> $DIR/method-call-lifetime-args-fail.rs:9:19 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:40:24 + --> $DIR/method-call-lifetime-args-fail.rs:42:24 | LL | S::late_implicit::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:7:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:42:24 + --> $DIR/method-call-lifetime-args-fail.rs:44:24 | LL | S::late_implicit::<'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:7:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:44:24 + --> $DIR/method-call-lifetime-args-fail.rs:46:24 | LL | S::late_implicit::<'static, 'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:7:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:47:30 + --> $DIR/method-call-lifetime-args-fail.rs:49:30 | LL | S::late_implicit_early::<'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:8:41 + --> $DIR/method-call-lifetime-args-fail.rs:10:41 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:49:30 + --> $DIR/method-call-lifetime-args-fail.rs:51:30 | LL | S::late_implicit_early::<'static, 'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:8:41 + --> $DIR/method-call-lifetime-args-fail.rs:10:41 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:52:35 + --> $DIR/method-call-lifetime-args-fail.rs:54:35 | LL | S::late_implicit_self_early::<'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:9:37 + --> $DIR/method-call-lifetime-args-fail.rs:11:37 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:54:35 + --> $DIR/method-call-lifetime-args-fail.rs:56:35 | LL | S::late_implicit_self_early::<'static, 'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:9:37 + --> $DIR/method-call-lifetime-args-fail.rs:11:37 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:57:28 + --> $DIR/method-call-lifetime-args-fail.rs:59:28 | LL | S::late_unused_early::<'static, 'static>(S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:10:26 + --> $DIR/method-call-lifetime-args-fail.rs:12:26 | LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:59:28 + --> $DIR/method-call-lifetime-args-fail.rs:61:28 | LL | S::late_unused_early::<'static, 'static, 'static>(S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:10:26 + --> $DIR/method-call-lifetime-args-fail.rs:12:26 | LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ -error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/method-call-lifetime-args-fail.rs:63:5 +error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied + --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static>(S); - | ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments + | ^^^^^ ------- supplied 1 lifetime argument + | | + | expected 2 lifetime arguments + | +note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` + --> $DIR/method-call-lifetime-args-fail.rs:8:8 + | +LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } + | ^^^^^ -- -- +help: add missing lifetime argument + | +LL | S::early::<'static, 'b>(S); + | ^^^^ -error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/method-call-lifetime-args-fail.rs:65:34 +error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied + --> $DIR/method-call-lifetime-args-fail.rs:67:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^^^ unexpected lifetime argument + | ^^^^^ --------- help: remove this lifetime argument + | | + | expected 2 lifetime arguments + | +note: associated function defined here, with 2 lifetime parameters: `'a`, `'b` + --> $DIR/method-call-lifetime-args-fail.rs:8:8 + | +LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } + | ^^^^^ -- -- error: aborting due to 18 previous errors |
