diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-02-05 21:08:07 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-02-11 12:42:00 -0800 |
| commit | 683ebc2dec0a5b88eb3eaf146e6855ea299d17b8 (patch) | |
| tree | 34406a93baacf0175755a5be55953b6af74369b4 /src/test/ui/methods | |
| parent | a19edd6b161521a4f66716b3b45b8cf4d3f03f3a (diff) | |
| download | rust-683ebc2dec0a5b88eb3eaf146e6855ea299d17b8.tar.gz rust-683ebc2dec0a5b88eb3eaf146e6855ea299d17b8.zip | |
On mismatched argument count point at arguments
Diffstat (limited to 'src/test/ui/methods')
| -rw-r--r-- | src/test/ui/methods/method-call-err-msg.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/methods/method-call-err-msg.stderr | 39 |
2 files changed, 33 insertions, 14 deletions
diff --git a/src/test/ui/methods/method-call-err-msg.rs b/src/test/ui/methods/method-call-err-msg.rs index 5ff4b412667..9bfacc7babf 100644 --- a/src/test/ui/methods/method-call-err-msg.rs +++ b/src/test/ui/methods/method-call-err-msg.rs @@ -5,16 +5,18 @@ impl Foo { fn zero(self) -> Foo { self } fn one(self, _: isize) -> Foo { self } fn two(self, _: isize, _: isize) -> Foo { self } + fn three<T>(self, _: T, _: T, _: T) -> Foo { self } } fn main() { let x = Foo; - x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied - .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied - .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied + x.zero(0) //~ ERROR this function takes 0 arguments but 1 argument was supplied + .one() //~ ERROR this function takes 1 argument but 0 arguments were supplied + .two(0); //~ ERROR this function takes 2 arguments but 1 argument was supplied let y = Foo; y.zero() .take() //~ ERROR no method named `take` found .one(0); + y.three::<usize>(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied } diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 7efdd91708a..ab1ef5b9d5a 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -1,32 +1,38 @@ -error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:12:7 +error[E0061]: this function takes 0 arguments but 1 argument was supplied + --> $DIR/method-call-err-msg.rs:13:7 | LL | fn zero(self) -> Foo { self } | -------------------- defined here ... LL | x.zero(0) - | ^^^^ expected 0 parameters + | ^^^^ - supplied 1 argument + | | + | expected 0 arguments -error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/method-call-err-msg.rs:13:7 +error[E0061]: this function takes 1 argument but 0 arguments were supplied + --> $DIR/method-call-err-msg.rs:14:7 | LL | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here ... LL | .one() - | ^^^ expected 1 parameter + | ^^^- supplied 0 arguments + | | + | expected 1 argument -error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:14:7 +error[E0061]: this function takes 2 arguments but 1 argument was supplied + --> $DIR/method-call-err-msg.rs:15:7 | LL | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here ... LL | .two(0); - | ^^^ expected 2 parameters + | ^^^ - supplied 1 argument + | | + | expected 2 arguments error[E0599]: no method named `take` found for struct `Foo` in the current scope - --> $DIR/method-call-err-msg.rs:18:7 + --> $DIR/method-call-err-msg.rs:19:7 | LL | pub struct Foo; | --------------- method `take` not found for this @@ -41,7 +47,18 @@ LL | .take() candidate #1: `std::io::Read` candidate #2: `std::iter::Iterator` -error: aborting due to 4 previous errors +error[E0061]: this function takes 3 arguments but 0 arguments were supplied + --> $DIR/method-call-err-msg.rs:21:7 + | +LL | fn three<T>(self, _: T, _: T, _: T) -> Foo { self } + | ------------------------------------------ defined here +... +LL | y.three::<usize>(); + | ^^^^^--------- supplied 0 arguments + | | + | expected 3 arguments + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0061, E0599. For more information about an error, try `rustc --explain E0061`. |
