Skip to content

Generic trait impl conflicts with all other impls #8075

@sfackler

Description

@sfackler
~ > 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions