-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Regression in method resolution through Deref #17594
Comments
This works fine if you change the call to: (*b.borrow()).foo() #17464 seems to indicate that this is intentional. |
I don't think that applies. If |
So it should back off and continue dereferencing instead? That would certainly be more intuitive and convenient behavior. |
That's what I would expect. |
This example seems to have worked before due to the special treatment of inherent methods. It's possible to construct an example that does not use them that fails in a similar way even prior to #17464: trait Foo {
fn foo(&self) { fail!() }
}
impl<'a, T> Foo for &'a T where T: Clone {}
trait UsableFoo {
fn foo(&self) {}
}
struct Bar;
impl UsableFoo for Bar {}
fn main() {
let b = &&Bar;
b.foo();
}
|
Interesting! I wonder if this is a duplicate, then. |
@sfackler I think the problem here is partly that we still don't have full trait reform -- in other words, the trait matching code sees the blanket impl and assumes it applies, without first checking the |
This is fallout (intensional) from the change to out inherent and trait methods on equal footing. However @aturon is correct that once I integrated conditional/multi dispatch into method resolution (next patch...) this should work again. |
Should I close this as a dup of the trait reform issue? |
Closing as dup of #5527 |
I'm opening this and flagging as needs test. It works now. |
(Also, PR #18224 adds a test) |
minor: Update manual.adoc
This should compile but no longer does:
Note that calling
Bar.foo()
directly works.The text was updated successfully, but these errors were encountered: