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

Blanket impls constrained by different associated types falsely flagged as conflicting #86605

Closed
boringcactus opened this issue Jun 24, 2021 · 1 comment
Labels
C-bug Category: This is a bug.

Comments

@boringcactus
Copy link
Contributor

I tried this code (aggressively simplified from Diesel, with which I originally encountered this bug):

trait Backend {
    type RawValue;
}

trait FromSql<B: Backend> {}

impl<B: Backend<RawValue=()>> FromSql<B> for String {}
impl<B: Backend<RawValue=u8>> FromSql<B> for String {}

I expected to see this happen: this code compiles, because by definition nothing can implement both Backend<RawValue=()> and Backend<RawValue=u8>.

Instead, this happened: rustc gives error[E0119]: conflicting implementations of trait 'FromSql<_>' for type 'std::string::String'

Meta

This happens across stable/beta/nightly on the Rust playground.

@boringcactus boringcactus added the C-bug Category: This is a bug. label Jun 24, 2021
@jonas-schievink
Copy link
Contributor

Looks like a duplicate of #20400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants