diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2017-12-10 13:45:24 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2017-12-10 21:03:58 -0800 |
| commit | 92da91313ce15ad3830b3dacd31bdeb8a95e5346 (patch) | |
| tree | 42a6d829ff5152dbb323bf9281a11db64ea3e5a5 | |
| parent | 8ee82d08ac17945a770748c9943ebacc604be935 (diff) | |
| download | rust-92da91313ce15ad3830b3dacd31bdeb8a95e5346.tar.gz rust-92da91313ce15ad3830b3dacd31bdeb8a95e5346.zip | |
Add closure defined outside of call case to arg count mismatch test
| -rw-r--r-- | src/test/ui/mismatched_types/closure-arg-count.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/closure-arg-count.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/fn-variance-1.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/fn-variance-1.stderr | 10 |
4 files changed, 20 insertions, 9 deletions
diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index 712b7ece051..1ee24e39852 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -29,6 +29,9 @@ fn main() { //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); //~^ ERROR function is expected to take + let bar = |i, x, y| i; + let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); + //~^ ERROR closure is expected to take } fn foo() {} diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index bd1b6f5eb2e..216f39bac54 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -62,8 +62,16 @@ error[E0593]: function is expected to take a single 2-tuple as argument, but it 30 | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); | ^^^ expected function that takes a single 2-tuple as argument ... -34 | fn foo() {} +37 | fn foo() {} | -------- takes 0 arguments -error: aborting due to 8 previous errors +error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments + --> $DIR/closure-arg-count.rs:33:53 + | +32 | let bar = |i, x, y| i; + | --------- takes 3 distinct arguments +33 | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); + | ^^^ expected closure that takes a single 2-tuple as argument + +error: aborting due to 9 previous errors diff --git a/src/test/ui/mismatched_types/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs index e9e34abc092..af691663411 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.rs +++ b/src/test/ui/mismatched_types/fn-variance-1.rs @@ -9,8 +9,10 @@ // except according to those terms. fn takes_imm(x: &isize) { } +//~^ NOTE found signature fn takes_mut(x: &mut isize) { } +//~^ NOTE found signature fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { f(t) @@ -22,12 +24,10 @@ fn main() { //~^ ERROR type mismatch //~| NOTE required by `apply` //~| NOTE expected signature - //~| NOTE found signature apply(&mut 3, takes_mut); apply(&mut 3, takes_imm); //~^ ERROR type mismatch //~| NOTE required by `apply` //~| NOTE expected signature - //~| NOTE found signature } diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 3eda5bc0191..856efcd4218 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,21 +1,21 @@ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:21:5 + --> $DIR/fn-variance-1.rs:23:5 | -13 | fn takes_mut(x: &mut isize) { } +14 | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` ... -21 | apply(&3, takes_mut); +23 | apply(&3, takes_mut); | ^^^^^ expected signature of `fn(&{integer}) -> _` | = note: required by `apply` error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:28:5 + --> $DIR/fn-variance-1.rs:29:5 | 11 | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` ... -28 | apply(&mut 3, takes_imm); +29 | apply(&mut 3, takes_imm); | ^^^^^ expected signature of `fn(&mut {integer}) -> _` | = note: required by `apply` |
