diff options
| author | Geoffry Song <goffrie@dropbox.com> | 2017-10-08 18:13:37 -0700 |
|---|---|---|
| committer | Geoffry Song <goffrie@gmail.com> | 2017-10-13 20:20:22 -0700 |
| commit | bb4d1caad7f60d095b730fff417e2ac461254600 (patch) | |
| tree | 8c9aa619d59b64337ba554708d3b2b248628f443 /src/test | |
| parent | fbb5054fa9fb9dac785553d6b2baa765f5c0e999 (diff) | |
| download | rust-bb4d1caad7f60d095b730fff417e2ac461254600.tar.gz rust-bb4d1caad7f60d095b730fff417e2ac461254600.zip | |
Pass the full span for method calls
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/method-call-err-msg.rs (renamed from src/test/compile-fail/method-call-err-msg.rs) | 0 | ||||
| -rw-r--r-- | src/test/ui/method-call-err-msg.stderr | 44 | ||||
| -rw-r--r-- | src/test/ui/span/missing-unit-argument.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/span/missing-unit-argument.stderr | 54 |
4 files changed, 93 insertions, 13 deletions
diff --git a/src/test/compile-fail/method-call-err-msg.rs b/src/test/ui/method-call-err-msg.rs index 14fa74d1f32..14fa74d1f32 100644 --- a/src/test/compile-fail/method-call-err-msg.rs +++ b/src/test/ui/method-call-err-msg.rs diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/method-call-err-msg.stderr new file mode 100644 index 00000000000..c39c62daf9e --- /dev/null +++ b/src/test/ui/method-call-err-msg.stderr @@ -0,0 +1,44 @@ +error[E0061]: this function takes 0 parameters but 1 parameter was supplied + --> $DIR/method-call-err-msg.rs:25:12 + | +15 | fn zero(self) -> Foo { self } + | ----------------------------- defined here +... +25 | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied + | ^ expected 0 parameters + +error[E0061]: this function takes 1 parameter but 0 parameters were supplied + --> $DIR/method-call-err-msg.rs:27:7 + | +17 | fn one(self, _: isize) -> Foo { self } + | -------------------------------------- defined here +... +27 | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied + | ^^^ expected 1 parameter + +error[E0061]: this function takes 2 parameters but 1 parameter was supplied + --> $DIR/method-call-err-msg.rs:29:11 + | +19 | fn two(self, _: isize, _: isize) -> Foo { self } + | ------------------------------------------------ defined here +... +29 | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied + | ^ expected 2 parameters + +error[E0599]: no method named `take` found for type `Foo` in the current scope + --> $DIR/method-call-err-msg.rs:34:7 + | +34 | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope + | ^^^^ + | + = note: the method `take` exists but the following trait bounds were not satisfied: + `&mut Foo : std::iter::Iterator` + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following traits define an item `take`, perhaps you need to implement one of them: + candidate #1: `std::collections::hash::Recover` + candidate #2: `std::io::Read` + candidate #3: `std::iter::Iterator` + candidate #4: `alloc::btree::Recover` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs index 2cdab5bedc4..ba1a999121c 100644 --- a/src/test/ui/span/missing-unit-argument.rs +++ b/src/test/ui/span/missing-unit-argument.rs @@ -11,9 +11,17 @@ fn foo(():(), ():()) {} fn bar(():()) {} +struct S; +impl S { + fn baz(self, (): ()) { } + fn generic<T>(self, _: T) { } +} + fn main() { let _: Result<(), String> = Ok(); foo(); foo(()); bar(); + S.baz(); + S.generic::<()>(); } diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index e508a30d182..af558d0ab83 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,45 +1,73 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:15:33 + --> $DIR/missing-unit-argument.rs:21:33 | -15 | let _: Result<(), String> = Ok(); +21 | let _: Result<(), String> = Ok(); | ^^^^ | -help: expected the unit value `()`. You can create one with a pair of parenthesis +help: expected the unit value `()`; create it with empty parentheses | -15 | let _: Result<(), String> = Ok(()); +21 | let _: Result<(), String> = Ok(()); | ^^ error[E0061]: this function takes 2 parameters but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:16:5 + --> $DIR/missing-unit-argument.rs:22:5 | 11 | fn foo(():(), ():()) {} | ----------------------- defined here ... -16 | foo(); +22 | foo(); | ^^^^^ expected 2 parameters error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/missing-unit-argument.rs:17:9 + --> $DIR/missing-unit-argument.rs:23:9 | 11 | fn foo(():(), ():()) {} | ----------------------- defined here ... -17 | foo(()); +23 | foo(()); | ^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:18:5 + --> $DIR/missing-unit-argument.rs:24:5 | 12 | fn bar(():()) {} | ---------------- defined here ... -18 | bar(); +24 | bar(); | ^^^^^ | -help: expected the unit value `()`. You can create one with a pair of parenthesis +help: expected the unit value `()`; create it with empty parentheses | -18 | bar(()); +24 | bar(()); | ^^ -error: aborting due to 4 previous errors +error[E0061]: this function takes 1 parameter but 0 parameters were supplied + --> $DIR/missing-unit-argument.rs:25:7 + | +16 | fn baz(self, (): ()) { } + | ------------------------ defined here +... +25 | S.baz(); + | ^^^ + | +help: expected the unit value `()`; create it with empty parentheses + | +25 | S.baz(()); + | ^^ + +error[E0061]: this function takes 1 parameter but 0 parameters were supplied + --> $DIR/missing-unit-argument.rs:26:7 + | +17 | fn generic<T>(self, _: T) { } + | ----------------------------- defined here +... +26 | S.generic::<()>(); + | ^^^^^^^ + | +help: expected the unit value `()`; create it with empty parentheses + | +26 | S.generic::<()>(()); + | ^^ + +error: aborting due to 6 previous errors |
