-
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
A strange processing methods visibility #22684
Comments
|
This is rather confusing from user's point of view. Because by definition, a private method doesn't show up in the rustdoc. So looking up rustdoc doesn't help diagnosing this particular error. I wonder what is the optimal solution here. Maybe an help message of some sort? |
I've created a self-contianed example of this behavior: mod foo {
pub struct Foo;
impl Foo {
fn bar(&self) {
println!("private bar in foo");
}
}
pub trait Baz {
fn bar(&self);
}
impl Baz for Foo {
fn bar(&self) {
println!("public bar in foo from Baz");
}
}
}
fn main() {
let mut f = foo::Foo;
f.bar(); // doesn't work
let b: &mut foo::Baz = &mut f;
b.bar(); // works
} /cc @rust-lang/lang . I am not sure that this is fixible? It would seem like a big change to modify these rules. |
Nominating for discussion at next lang team meeting. |
In @rust-lang/lang meeting we decided that this should indeed follow the same lookup rules as #12808. |
triage: P-medium |
@nikomatsakis This is fixed in the above PR -- I'll add @steveklabnik's example as a test. |
rustc 1.0.0-nightly (2b01a37 2015-02-21) (built 2015-02-22)
I create file with content:
And have compilation errors:
I do not understand what is happening due to this error, because this cast is essentially doing nothing.
The text was updated successfully, but these errors were encountered: