Rollup merge of #67127 - estebank:disambiguate-suggestion, r=varkor

Use structured suggestion for disambiguating method calls

Fix #65635.
This commit is contained in:
Mazdak Farrokhzad 2019-12-20 12:17:20 +01:00 committed by GitHub
commit f0eb4b4752
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 274 additions and 82 deletions

View file

@ -2,7 +2,10 @@ error[E0034]: multiple applicable items in scope
--> $DIR/issue-18446.rs:18:7
|
LL | x.foo();
| ^^^ multiple `foo` found
| --^^^--
| | |
| | multiple `foo` found
| help: disambiguate the method call for candidate #2: `T::foo(&x)`
|
note: candidate #1 is defined in an impl for the type `dyn T`
--> $DIR/issue-18446.rs:9:5
@ -14,7 +17,6 @@ note: candidate #2 is defined in the trait `T`
|
LL | fn foo(&self);
| ^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `T::foo(&x)` instead
error: aborting due to previous error

View file

@ -9,13 +9,19 @@ note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type
|
LL | fn to_int(&self) -> isize { 0 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `ToPrimitive::to_int(&self)` instead
note: candidate #2 is defined in an impl of the trait `Add` for the type `isize`
--> $DIR/issue-3702-2.rs:14:5
|
LL | fn to_int(&self) -> isize { *self }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `Add::to_int(&self)` instead
help: disambiguate the method call for candidate #1
|
LL | ToPrimitive::to_int(&self) + other.to_int()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method call for candidate #2
|
LL | Add::to_int(&self) + other.to_int()
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -9,13 +9,19 @@ note: candidate #1 is defined in an impl of the trait `async` for the type `r#fn
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `async::r#struct(r#fn {})` instead
note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn`
--> $DIR/issue-65634-raw-ident-suggestion.rs:10:5
|
LL | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `await::r#struct(r#fn {})` instead
help: disambiguate the method call for candidate #1
|
LL | async::r#struct(&r#fn {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method call for candidate #2
|
LL | await::r#struct(&r#fn {});
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error