Skip to content

Incorrect handling of trait associated type #114926

Closed
@xlc

Description

@xlc

I tried this code:

https://github.com/xlc/trait-bug

I expected to see this happen: compiles

Instead, this happened:

   Checking foo v0.1.0 (/Users/xiliangchen/projects/acala/trait-bug/foo)
error[E0119]: conflicting implementations of trait `From<Foo>` for type `Foo`
  --> foo/src/lib.rs:11:1
   |
11 | impl From<<baz::Baz as ::baz::BazTrait>::BazType> for Foo {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: conflicting implementation in crate `core`:
           - impl<T> From<T> for T;

For more information about this error, try `rustc --explain E0119`.
error: could not compile `foo` (lib) due to previous error

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (07438b092 2023-08-16)
binary: rustc
commit-hash: 07438b0928c6691d6ee734a5a77823ec143be94d
commit-date: 2023-08-16
host: aarch64-apple-darwin
release: 1.73.0-nightly
LLVM version: 17.0.0

Note that the code will compile if all the types are in a single crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions