-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #120632 - trevyn:issue-109195, r=oli-obk
For E0223, suggest associated functions that are similar to the path e.g. for `String::from::utf8`, suggest `String::from_utf8` Closes #109195
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
fn main() { | ||
String::from::utf8; | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP there is an associated function with a similar name: `from_utf8` | ||
String::from::utf8(); | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP there is an associated function with a similar name: `from_utf8` | ||
String::from::utf16(); | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP there is an associated function with a similar name: `from_utf16` | ||
String::from::method_that_doesnt_exist(); | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP if there were a trait named `Example` with associated type `from` | ||
str::from::utf8(); | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP if there were a trait named `Example` with associated type `from` | ||
str::from::utf8_mut(); | ||
//~^ ERROR ambiguous associated type [E0223] | ||
//~| HELP if there were a trait named `Example` with associated type `from` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:2:5 | ||
| | ||
LL | String::from::utf8; | ||
| ^^^^^^^^^^^^ | ||
| | ||
help: there is an associated function with a similar name: `from_utf8` | ||
| | ||
LL | String::from_utf8; | ||
| ~~~~~~~~~ | ||
|
||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:5:5 | ||
| | ||
LL | String::from::utf8(); | ||
| ^^^^^^^^^^^^ | ||
| | ||
help: there is an associated function with a similar name: `from_utf8` | ||
| | ||
LL | String::from_utf8(); | ||
| ~~~~~~~~~ | ||
|
||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:8:5 | ||
| | ||
LL | String::from::utf16(); | ||
| ^^^^^^^^^^^^ | ||
| | ||
help: there is an associated function with a similar name: `from_utf16` | ||
| | ||
LL | String::from_utf16(); | ||
| ~~~~~~~~~~ | ||
|
||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:11:5 | ||
| | ||
LL | String::from::method_that_doesnt_exist(); | ||
| ^^^^^^^^^^^^ | ||
| | ||
help: if there were a trait named `Example` with associated type `from` implemented for `String`, you could use the fully-qualified path | ||
| | ||
LL | <String as Example>::from::method_that_doesnt_exist(); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:14:5 | ||
| | ||
LL | str::from::utf8(); | ||
| ^^^^^^^^^ | ||
| | ||
help: if there were a trait named `Example` with associated type `from` implemented for `str`, you could use the fully-qualified path | ||
| | ||
LL | <str as Example>::from::utf8(); | ||
| ~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error[E0223]: ambiguous associated type | ||
--> $DIR/issue-109195.rs:17:5 | ||
| | ||
LL | str::from::utf8_mut(); | ||
| ^^^^^^^^^ | ||
| | ||
help: if there were a trait named `Example` with associated type `from` implemented for `str`, you could use the fully-qualified path | ||
| | ||
LL | <str as Example>::from::utf8_mut(); | ||
| ~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0223`. |