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
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 20, 2025
Roses are red,
Biolets are blue,
A typo happened,
too late now

You might be asking,
what are Biolets now?
And to be honest,
I have no clue

---

The cat of this release is `Vera` nominated by @and-reas-se

<img height=500
src="https://github.com/user-attachments/assets/82e6fccc-1f6d-4d29-b6bb-0bd4f3584593"
alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
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