-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code:
#![allow(non_camel_case_types)]
trait r#async {
fn r#struct(&self) {
println!("async");
}
}
trait r#await {
fn r#struct(&self) {
println!("await");
}
}
struct r#fn {}
impl r#async for r#fn {}
impl r#await for r#fn {}
fn main() {
r#fn {}.r#struct();
}
Error:
error[E0034]: multiple applicable items in scope
--> src/main.rs:22:13
|
22 | r#fn {}.r#struct();
| ^^^^^^^^ multiple `struct` found
|
note: candidate #1 is defined in an impl of the trait `async` for the type `fn`
--> src/main.rs:5:5
|
5 | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `async::struct(r#fn {})` instead
note: candidate #2 is defined in an impl of the trait `await` for the type `fn`
--> src/main.rs:11:5
|
11 | fn r#struct(&self) {
| ^^^^^^^^^^^^^^^^^^
= help: to disambiguate the method call, write `await::struct(r#fn {})` instead
async::struct(r#fn {})
should be r#async::r#struct(&r#fn {})
and await::struct(r#fn {})
should be r#await::r#struct(&r#fn {})
. It also misses that function signatures require not self
but &self
, however this also happens when not using raw identifiers, so I will open another issue for this case.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.