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

Generic trait impl conflicts with all other impls #8075

Closed
sfackler opened this issue Jul 27, 2013 · 3 comments
Closed

Generic trait impl conflicts with all other impls #8075

sfackler opened this issue Jul 27, 2013 · 3 comments
Labels
A-traits Area: Trait system A-typesystem Area: The type system

Comments

@sfackler
Copy link
Member

~ > cat test.rs
trait Foo {}

trait Bar {}

impl<T: Bar> Foo for T {}

impl Foo for int {}
~ > rustc --lib test.rs
test.rs:7:0: 7:19 error: conflicting implementations for a trait
test.rs:7 impl Foo for int {}
          ^~~~~~~~~~~~~~~~~~~
test.rs:5:0: 5:25 note: note conflicting implementation here
test.rs:5 impl<T: Bar> Foo for T {}
          ^~~~~~~~~~~~~~~~~~~~~~~~~
test.rs:5:0: 5:25 error: conflicting implementations for a trait
test.rs:5 impl<T: Bar> Foo for T {}
          ^~~~~~~~~~~~~~~~~~~~~~~~~
test.rs:7:0: 7:19 note: note conflicting implementation here
test.rs:7 impl Foo for int {}
          ^~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

I think this is related to #3429 but is far more general.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 1, 2013

subbug of #5527. I briefly tried to find whether this is a duplicate of another bug (besides #3429, which I think it is a dupe of, but this seems to be a simpler illustration of the issue so it may be worth keeping separately so that future bug seekers will identify it as for what they are looking).

@japaric
Copy link
Member

japaric commented Oct 13, 2014

This works after the multidispatch PR (#17669) landed and should be closed.

@alexcrichton
Copy link
Member

Thanks @japaric!

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 17, 2021
…xFrednet

Clarify the purpose of the non_send lint

PR 2/2 for issue rust-lang#8045. Tried to tone down the warning message and clarify the intention of the lint. Specifically, I added a description that this lint tries to detect "types that are not safe to be sent to another thread".

changelog: none

r? `@xFrednet`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system A-typesystem Area: The type system
Projects
None yet
Development

No branches or pull requests

4 participants