Skip to content
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

Autoref faulty on universal trait implementations #14229

Closed
SiegeLord opened this issue May 15, 2014 · 3 comments · Fixed by #27146
Closed

Autoref faulty on universal trait implementations #14229

SiegeLord opened this issue May 15, 2014 · 3 comments · Fixed by #27146
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@SiegeLord
Copy link
Contributor

Consider this code:

trait Foo
{
    fn foo(self) {}
}

trait Bar
{
    fn bar(self) {}
}

struct S;

impl<'l> Foo for &'l S {}

impl<T: Foo> Bar for T {}

fn main()
{
    let s = S;
    s.foo(); // Works fine
    (&s).bar(); // Works fine
    s.bar(); // Doesn't work
}

The error is:

test.rs:22:5: 22:12 error: failed to find an implementation of trait Foo for S
test.rs:22     s.bar();

It'd be nice if the explicit ref wasn't required in this case.

@alexcrichton
Copy link
Member

cc #10456

@alexcrichton
Copy link
Member

This has now been fixed.

@alexcrichton alexcrichton added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jan 5, 2015
@tamird
Copy link
Contributor

tamird commented Mar 15, 2015

steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 21, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 21, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 21, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 22, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 22, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 22, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants