about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-31 18:57:27 +0000
committerbors <bors@rust-lang.org>2015-12-31 18:57:27 +0000
commit7d9543345c785ea777671baab306d95fed8ee94b (patch)
treea81f88fb2d731300a28ccec755cb098085c88128
parent53cd573bc8d79393676783ec124e4a2000166956 (diff)
parent50b43f6bd827e80e4695b6e43904cb4ba6459932 (diff)
downloadrust-7d9543345c785ea777671baab306d95fed8ee94b.tar.gz
rust-7d9543345c785ea777671baab306d95fed8ee94b.zip
Auto merge of #28469 - DenisKolodin:master, r=steveklabnik
-rw-r--r--src/librustc/diagnostics.rs41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs
index 6a5910074d9..715850154f6 100644
--- a/src/librustc/diagnostics.rs
+++ b/src/librustc/diagnostics.rs
@@ -1657,6 +1657,46 @@ This will fail because the compiler does not know which instance of `Foo` to
 call `bar` on. Change `Foo::bar()` to `Foo::<T>::bar()` to resolve the error.
 "##,
 
+E0283: r##"
+This error occurs when the compiler doesn't have enough information
+to unambiguously choose an implementation.
+
+For example:
+
+```
+trait Generator {
+    fn create() -> u32;
+}
+
+struct Impl;
+impl Generator for Impl {
+    fn create() -> u32 { 1 }
+}
+
+struct AnotherImpl;
+impl Generator for AnotherImpl {
+    fn create() -> u32 { 2 }
+}
+
+fn main() {
+    let cont: u32 = Generator::create();
+    // error, impossible to choose one of Generator trait implementation
+    // Impl or AnotherImpl? Maybe anything else?
+}
+```
+
+To resolve this error use the concrete type:
+
+```
+fn main() {
+    let gen1 = AnotherImpl::create();
+
+    // if there are multiple methods with same name (different traits)
+    let gen2 = <AnotherImpl as Generator>::create();
+}
+```
+"##,
+
 E0296: r##"
 This error indicates that the given recursion limit could not be parsed. Ensure
 that the value provided is a positive integer between quotes, like so:
@@ -2279,7 +2319,6 @@ register_diagnostics! {
     E0278, // requirement is not satisfied
     E0279, // requirement is not satisfied
     E0280, // requirement is not satisfied
-    E0283, // cannot resolve type
     E0284, // cannot resolve type
     E0285, // overflow evaluation builtin bounds
     E0298, // mismatched types between arms