- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Description
Test case:
fn main() {}
struct A;
impl A {
    fn b(&mut self) {
        self.a()
    }
}
trait Foo {}
trait Bar {
    fn a(&self);
}
impl Foo for A {}
impl<T> Bar for T where T: Foo {
    fn a(&self) {}
}rustc output:
a.rs:7:9: 7:17 error: the trait `Foo` is not implemented for the type `&mut A`
a.rs:7         self.a()
               ^~~~~~~~
error: aborting due to previous error
Expected behavior: &mut self is automatically converted to &self in the self.a() call.
The bug disappears if fn b is changed to take &self, if fn a is changed to take &mut self, or if the call is changed to (&*self).a().
CC @aturon
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.