about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-08-30 00:38:05 +0000
committerbors <bors@rust-lang.org>2015-08-30 00:38:05 +0000
commitf3f23bf9c5ee16dab8c25bb5d301d689fbbe0cf1 (patch)
tree2cf4fa54c4a29c6c7b25e07be82d4eace20aff14
parent9982314577e3d86da87b8024496d932b2cfff298 (diff)
parent9ed30c62143f2615f8424d9da63eef77978e3346 (diff)
downloadrust-f3f23bf9c5ee16dab8c25bb5d301d689fbbe0cf1.tar.gz
rust-f3f23bf9c5ee16dab8c25bb5d301d689fbbe0cf1.zip
Auto merge of #28086 - AlisdairO:diagnostics281, r=arielb1
As title :-)
Part of #24407.

r? @Manishearth
-rw-r--r--src/librustc/diagnostics.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 5f907c6cbee..696b38219f4 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -1487,6 +1487,26 @@ fn main() {
 ```
 "##,
 
+E0281: r##"
+You tried to supply a type which doesn't implement some trait in a location
+which expected that trait. This error typically occurs when working with
+`Fn`-based types. Erroneous code example:
+
+```
+fn foo<F: Fn()>(x: F) { }
+
+fn main() {
+    // type mismatch: the type ... implements the trait `core::ops::Fn<(_,)>`,
+    // but the trait `core::ops::Fn<()>` is required (expected (), found tuple
+    // [E0281]
+    foo(|y| { });
+}
+```
+
+The issue in this case is that `foo` is defined as accepting a `Fn` with no
+arguments, but the closure we attempted to pass to it requires one argument.
+"##,
+
 E0282: r##"
 This error indicates that type inference did not result in one unique possible
 type, and extra information is required. In most cases this can be provided
@@ -1867,7 +1887,6 @@ register_diagnostics! {
     E0278, // requirement is not satisfied
     E0279, // requirement is not satisfied
     E0280, // requirement is not satisfied
-    E0281, // type implements trait but other trait is required
     E0283, // cannot resolve type
     E0284, // cannot resolve type
     E0285, // overflow evaluation builtin bounds