Skip to content

Commit 7d95433

Browse files
committed
Auto merge of rust-lang#28469 - DenisKolodin:master, r=steveklabnik
2 parents 53cd573 + 50b43f6 commit 7d95433

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

src/librustc/diagnostics.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,46 @@ This will fail because the compiler does not know which instance of `Foo` to
16571657
call `bar` on. Change `Foo::bar()` to `Foo::<T>::bar()` to resolve the error.
16581658
"##,
16591659

1660+
E0283: r##"
1661+
This error occurs when the compiler doesn't have enough information
1662+
to unambiguously choose an implementation.
1663+
1664+
For example:
1665+
1666+
```
1667+
trait Generator {
1668+
fn create() -> u32;
1669+
}
1670+
1671+
struct Impl;
1672+
impl Generator for Impl {
1673+
fn create() -> u32 { 1 }
1674+
}
1675+
1676+
struct AnotherImpl;
1677+
impl Generator for AnotherImpl {
1678+
fn create() -> u32 { 2 }
1679+
}
1680+
1681+
fn main() {
1682+
let cont: u32 = Generator::create();
1683+
// error, impossible to choose one of Generator trait implementation
1684+
// Impl or AnotherImpl? Maybe anything else?
1685+
}
1686+
```
1687+
1688+
To resolve this error use the concrete type:
1689+
1690+
```
1691+
fn main() {
1692+
let gen1 = AnotherImpl::create();
1693+
1694+
// if there are multiple methods with same name (different traits)
1695+
let gen2 = <AnotherImpl as Generator>::create();
1696+
}
1697+
```
1698+
"##,
1699+
16601700
E0296: r##"
16611701
This error indicates that the given recursion limit could not be parsed. Ensure
16621702
that the value provided is a positive integer between quotes, like so:
@@ -2279,7 +2319,6 @@ register_diagnostics! {
22792319
E0278, // requirement is not satisfied
22802320
E0279, // requirement is not satisfied
22812321
E0280, // requirement is not satisfied
2282-
E0283, // cannot resolve type
22832322
E0284, // cannot resolve type
22842323
E0285, // overflow evaluation builtin bounds
22852324
E0298, // mismatched types between arms

0 commit comments

Comments
 (0)