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
RES: prefer trait methods before private inherent methods #6685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better :) Maybe we could keep the old test with
impl Foo {
pub fn get(&self) { println("struct"); }
}
?
@Kobzol Hmm yep, Let's keep it |
@Kobzol Oh, actually there isn't a multiresolve because inherent impl wins |
Oh, ok, even better :) |
@Undin the PR awaiting the regression testing repairs :) |
@vlad20012 as we discussed in person, |
bors r+ |
6685: RES: prefer trait methods before private inherent methods r=vlad20012 a=vlad20012 Improves the #5661 fix: now resolve it to visible trait impl instead of private inherent impl: ```rust use foo::{Foo, Trait}; mod foo { pub struct Foo; impl Foo { // Private fn get(&self) { println!("struct"); } } pub trait Trait { fn get(&self); } impl Trait for Foo { fn get(&self) { println!("trait"); } } //X } fn main() { let f = foo::Foo; f.get(); //^ } ``` c.c. @Kobzol Co-authored-by: vlad20012 <beskvlad@gmail.com>
Build failed: |
bors retry EDIT: Oops, this is not my PR, I automatically retried it, since I got a CI bors notification in e-mail :D |
Build succeeded: |
Improves the #5661 fix: now resolve it to visible trait impl instead of private inherent impl:
c.c. @Kobzol