-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"multiple applicable methods in scope" error should list them #1946
Comments
even better, it should tell you which import brought the method into scope. |
The situation is better now:
|
Removing from 1.0 |
Visiting for triage, nothing to add |
Low, not 1.0 |
The error message is much better now: use foo::Foo;
use bar::Bar;
mod foo {
pub trait Foo {
fn baz(&self) {}
}
}
mod bar {
pub trait Bar {
fn baz(&self) {}
}
}
struct Quux;
#[cfg(not(error))]
impl Quux {
fn baz(&self) {}
}
impl foo::Foo for Quux {}
impl bar::Bar for Quux {}
fn main() {
Quux.baz();
} $ rustc --cfg error 1946.rs
1946.rs:27:10: 27:15 error: multiple applicable methods in scope [E0034]
1946.rs:27 Quux.baz();
^~~~~
1946.rs:23:1: 23:26 note: candidate #1 is defined in an impl of the trait `foo::Foo` for the type `Quux`
1946.rs:23 impl foo::Foo for Quux {}
^~~~~~~~~~~~~~~~~~~~~~~~~
1946.rs:24:1: 24:26 note: candidate #2 is defined in an impl of the trait `bar::Bar` for the type `Quux`
1946.rs:24 impl bar::Bar for Quux {}
^~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error It tells you the full path of the conflicting traits. I think the compiler could even suggest using UFCS to disambiguate: I've got one question tough, if
Not sure if that's intended, perhaps it should throw a warning? |
Yup, we get good error messages on this today. Closing. |
When calling a method and there are 'multiple applicable methods in scope' it's very hard to resolve the issue because the error doesn't tell you which implementations are causing the conflict.
The text was updated successfully, but these errors were encountered: