about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/mismatched_types/E0631.rs6
-rw-r--r--src/test/ui/mismatched_types/E0631.stderr32
-rw-r--r--src/test/ui/mismatched_types/closure-arg-count.rs6
-rw-r--r--src/test/ui/mismatched_types/closure-arg-count.stderr35
4 files changed, 45 insertions, 34 deletions
diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs
index e66ef6aaeda..83dbdb77abe 100644
--- a/src/test/ui/mismatched_types/E0631.rs
+++ b/src/test/ui/mismatched_types/E0631.rs
@@ -1,11 +1,11 @@
 #![feature(unboxed_closures)]
 
 fn foo<F: Fn(usize)>(_: F) {}
-fn bar<F: Fn<usize>>(_: F) {}
+fn bar<F: Fn<(usize,)>>(_: F) {}
 fn main() {
     fn f(_: u64) {}
     foo(|_: isize| {}); //~ ERROR type mismatch
-    bar(|_: isize| {}); //~ ERROR mismatched types
+    bar(|_: isize| {}); //~ ERROR type mismatch
     foo(f); //~ ERROR type mismatch
-    bar(f); //~ ERROR mismatched types
+    bar(f); //~ ERROR type mismatch
 }
diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr
index fefb6fea4eb..410ea4b0b34 100644
--- a/src/test/ui/mismatched_types/E0631.stderr
+++ b/src/test/ui/mismatched_types/E0631.stderr
@@ -14,19 +14,21 @@ note: required by a bound in `foo`
 LL | fn foo<F: Fn(usize)>(_: F) {}
    |           ^^^^^^^^^ required by this bound in `foo`
 
-error[E0308]: mismatched types
+error[E0631]: type mismatch in closure arguments
   --> $DIR/E0631.rs:8:5
    |
 LL |     bar(|_: isize| {});
-   |     ^^^ types differ
+   |     ^^^ ---------- found signature defined here
+   |     |
+   |     expected due to this
    |
-   = note: expected trait `Fn<usize>`
-              found trait `Fn<(isize,)>`
+   = note: expected closure signature `fn(usize) -> _`
+              found closure signature `fn(isize) -> _`
 note: required by a bound in `bar`
   --> $DIR/E0631.rs:4:11
    |
-LL | fn bar<F: Fn<usize>>(_: F) {}
-   |           ^^^^^^^^^ required by this bound in `bar`
+LL | fn bar<F: Fn<(usize,)>>(_: F) {}
+   |           ^^^^^^^^^^^^ required by this bound in `bar`
 
 error[E0631]: type mismatch in function arguments
   --> $DIR/E0631.rs:9:9
@@ -47,23 +49,25 @@ note: required by a bound in `foo`
 LL | fn foo<F: Fn(usize)>(_: F) {}
    |           ^^^^^^^^^ required by this bound in `foo`
 
-error[E0308]: mismatched types
+error[E0631]: type mismatch in function arguments
   --> $DIR/E0631.rs:10:9
    |
+LL |     fn f(_: u64) {}
+   |     ------------ found signature defined here
+...
 LL |     bar(f);
-   |     --- ^ types differ
+   |     --- ^ expected due to this
    |     |
    |     required by a bound introduced by this call
    |
-   = note: expected trait `Fn<usize>`
-              found trait `Fn<(u64,)>`
+   = note: expected function signature `fn(usize) -> _`
+              found function signature `fn(u64) -> _`
 note: required by a bound in `bar`
   --> $DIR/E0631.rs:4:11
    |
-LL | fn bar<F: Fn<usize>>(_: F) {}
-   |           ^^^^^^^^^ required by this bound in `bar`
+LL | fn bar<F: Fn<(usize,)>>(_: F) {}
+   |           ^^^^^^^^^^^^ required by this bound in `bar`
 
 error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0308, E0631.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs
index b6759d750c8..65c8d6a7e93 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.rs
+++ b/src/test/ui/mismatched_types/closure-arg-count.rs
@@ -1,6 +1,6 @@
 #![feature(unboxed_closures)]
 
-fn f<F: Fn<usize>>(_: F) {}
+fn f<F: Fn<(usize,)>>(_: F) {}
 fn main() {
     [1, 2, 3].sort_by(|| panic!());
     //~^ ERROR closure is expected to take
@@ -11,9 +11,9 @@ fn main() {
     [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
     //~^ ERROR closure is expected to take
     f(|| panic!());
-    //~^ ERROR mismatched types
+    //~^ ERROR closure is expected to take
     f(  move    || panic!());
-    //~^ ERROR mismatched types
+    //~^ ERROR closure is expected to take
 
     let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
     //~^ ERROR closure is expected to take
diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr
index d13e5d682da..a02ec819838 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count.stderr
@@ -45,33 +45,41 @@ help: change the closure to take multiple arguments instead of a single tuple
 LL |     [1, 2, 3].sort_by(|tuple, tuple2| panic!());
    |                       ~~~~~~~~~~~~~~~
 
-error[E0308]: mismatched types
+error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
   --> $DIR/closure-arg-count.rs:13:5
    |
 LL |     f(|| panic!());
-   |     ^ types differ
+   |     ^ -- takes 0 arguments
+   |     |
+   |     expected closure that takes 1 argument
    |
-   = note: expected trait `Fn<usize>`
-              found trait `Fn<()>`
 note: required by a bound in `f`
   --> $DIR/closure-arg-count.rs:3:9
    |
-LL | fn f<F: Fn<usize>>(_: F) {}
-   |         ^^^^^^^^^ required by this bound in `f`
+LL | fn f<F: Fn<(usize,)>>(_: F) {}
+   |         ^^^^^^^^^^^^ required by this bound in `f`
+help: consider changing the closure to take and ignore the expected argument
+   |
+LL |     f(|_| panic!());
+   |       ~~~
 
-error[E0308]: mismatched types
+error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
   --> $DIR/closure-arg-count.rs:15:5
    |
 LL |     f(  move    || panic!());
-   |     ^ types differ
+   |     ^   ---------- takes 0 arguments
+   |     |
+   |     expected closure that takes 1 argument
    |
-   = note: expected trait `Fn<usize>`
-              found trait `Fn<()>`
 note: required by a bound in `f`
   --> $DIR/closure-arg-count.rs:3:9
    |
-LL | fn f<F: Fn<usize>>(_: F) {}
-   |         ^^^^^^^^^ required by this bound in `f`
+LL | fn f<F: Fn<(usize,)>>(_: F) {}
+   |         ^^^^^^^^^^^^ required by this bound in `f`
+help: consider changing the closure to take and ignore the expected argument
+   |
+LL |     f(  move    |_| panic!());
+   |                 ~~~
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
   --> $DIR/closure-arg-count.rs:18:53
@@ -190,5 +198,4 @@ LL | fn call<F, R>(_: F) where F: FnOnce() -> R {}
 
 error: aborting due to 14 previous errors
 
-Some errors have detailed explanations: E0308, E0593.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0593`.