Closed
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.