-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
An impl on Vec<T> for trait T causes Vec::from_slice to disappear #15060
Comments
I think this is related to anonymous modules appearing, If you change to this you get another interesting error: trait T {}
impl<U: T> Vec<U> {
fn from_slice<'a>(x: &'a [uint]) -> Vec<uint> {
fail!()
}
}
fn main() { let r = Vec::from_slice(&[1u]); }
|
Note that a workaround is to wrap
Then you get the correct error message about trying to |
I've spent some time investigating this bug and I think that the cleanest thing to do is to fix #3785 (closed B-RFC right now, does anyone have a link to a relevant RFC?) and require Otherwise in the case of The current behaviour upon encountering break.rs:
break1.rs:
break.rs will error out with "unresolved name I'm sure I could come up with other examples of currently broken behaviour like this. |
@apoelstra the closing of that bug predates our RFC process, so there would not be a link to an RFC. |
Interestingly, this breaks in the opposite direction if you qualify the mod break1 {
pub struct MyGuy;
impl MyGuy {
pub fn do1() { println!("do 1"); }
}
}
impl break1::MyGuy {
fn do2() { println!("do 2"); }
}
fn main() {
break1::MyGuy::do1();
break1::MyGuy::do2();
}
|
My suggestion is that |
…he current module Followup to RFC 57. Fixes rust-lang#7607 Fixes rust-lang#8767 Fixes rust-lang#12729 Fixes rust-lang#15060
…tion of `MyStruct` This fixes rust-lang#15060 and rust-lang#3785.
The code
fails with
Removing the
impl
line causes the code to compile fine.Thx Ms2ger for finding such a small example case.
The text was updated successfully, but these errors were encountered: