-
Notifications
You must be signed in to change notification settings - Fork 13.3k
confusing diagnostic when calling a method that doesn't exist on a trait but exists on another trait #111312
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@rustbot claim |
What is your desired output? I browsed the tests and the current output is as expected to suggest implementing |
The following snippet works fine (play): trait Has {
fn has() {}
}
trait HasNot {}
impl Has for dyn HasNot {}
fn main() {
<dyn HasNot>::has();
} |
This is confusing, because the intention is almost never to call the trait method on a trait object. The diagnostic remains the same even if |
Using trait name without Then the first suggestion adds |
Sorry, I mean when |
For additional context, here's the original error that I got: I meant to use the bare function |
I think this may need a bit more works, and I open a related topic on internals. |
@rustbot claim |
Code
Current output
code snippet by @WaffleLapkin. (this is from December 2022)
The text was updated successfully, but these errors were encountered: