Closed
Description
Code
struct T();
trait Trait {
type Assoc;
fn f();
}
impl Trait for () {
type Assoc = T;
fn f() {
<Self>::Assoc()
}
}
fn main() {}
Current output
error[E0599]: no associated item named `Assoc` found for unit type `()` in the current scope
--> src/main.rs:13:17
|
13 | <Self>::Assoc()
| ^^^^^ associated item not found in `()`
|
help: to construct a value of type `T`, use the explicit path
|
13 - <Self>::Assoc()
13 + <T()
|
Desired output
error[E0599]: no associated item named `Assoc` found for unit type `()` in the current scope
--> src/main.rs:13:17
|
13 | <Self>::Assoc()
| ^^^^^ associated item not found in `()`
|
help: to construct a value of type `T`, use the explicit path
|
13 - <Self>::Assoc()
13 + T()
|
Rationale and extra context
<T()
is not valid syntax; T()
is.
Rust Version
1.89.0-nightly (2025-06-11 e703dff8fe220b78195c)