-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Confusing error: 'method read
has 1 parameters'
#5925
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
Comments
The following code is working: fn main() { Apparently the second x creates a new variable that hides the first x that is in the same scope. Is it intentional? |
@Xazax-hun, that's intentional behaviour, and unrelated to the original issue report. |
Here's a small code sample which exhibits this behavior: use a::Reader;
use b::Reader;
mod a {
pub trait Reader {
fn foo(int);
}
}
mod b {
pub trait Reader {
fn foo(int, int);
}
}
struct A;
impl Reader for A {
fn foo(_: int) {}
}
fn main() {
} with the error
|
I think, is it intentional? use b::Reader; If you change code, it will be done. |
The bug is about improving the error message. For example, instead of saying |
I am trying to implement my own trait called
Reader
, but I accidentally had a differentReader
trait in scope.It took some time to figure out that rustc and I were looking at different traits. It could tell me the path to the trait it is trying to match. Even better, it could tell me about alternate traits with the same name.
The text was updated successfully, but these errors were encountered: