Skip to content

Cargo is unable to resolve link conflicts for compiler extensions #4028

Closed
@ishitatsuyuki

Description

@ishitatsuyuki

When you use a crate that is also used inside rustc...

   Compiling rls v0.1.0 (file:///home/ishitatsuyuki/Documents/rls)
error[E0523]: found two different crates with name `bitflags` that are not distinguished by differing `-C metadata`. This will result in symbol conflicts between the two.
  --> src/build.rs:12:1
   |
12 | extern crate rustc;
   | ^^^^^^^^^^^^^^^^^^^

error: Could not compile `rls`.

To learn more, run the command again with --verbose.

Trigger conditions:

  • opt_level is set to 2 (upstream settings)
  • Using rustc_private with one of the crates that compiler also use (e.g. bitflags, rustc-serialize)

This is really... broken. This bug is discovered during the process of rust-lang/rust#41639. Most compiler plugins (I tried clippy) are not affected, due to the nature of minimal dependencies they're using. It can be also reproduced on them if I added the dependency and extern crate clause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions