Open
Description
Code
mod base {
pub trait T {
fn f();
}
pub struct S;
impl T for S {
fn f() {}
}
}
pub fn foo() {
base::T::f();
}
fn main() { }
Current output
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> awex.rs:14:5
|
3 | fn f();
| ------- `T::f` defined here
...
14 | base::T::f();
| ^^^^^^^^^^ cannot call associated function of trait
|
help: use the fully-qualified path to the only available implementation
|
14 | <S as base::T>::f();
| +++++ +
Desired output
help: use the fully-qualified path to the only available implementation
|
14 | <base::S as base::T>::f();
| +++++++++++ +
Rationale and extra context
Since base::S
has not been imported, the hint code should use base::S
rather than S
Other cases
No response
Anything else?
I noticed this in tests/ui/traits/static-method-generic-inference.rs
. Reduced to isolate the issue.