Skip to content

Spurious multiple crate version warning when using --extern #17186

Closed
@bkoropoff

Description

@bkoropoff

Test Case

lib.rs

#![crate_name = "bar"]
#![crate_type = "rlib"]

test.rs

#![feature(phase)]

#[phase(plugin, link)]
extern crate foo;

fn main() {
}

Build

$ rustc lib.rs
$ rustc test.rs --extern foo=./libbar.rlib

Output

warning: using multiple versions of crate `bar`
test.rs:4:1: 4:18 note: used here
test.rs:4 extern crate foo;
          ^~~~~~~~~~~~~~~~~
note: crate name: bar
test.rs:4:1: 4:18 note: used here
test.rs:4 extern crate foo;
          ^~~~~~~~~~~~~~~~~
note: crate name: bar

Analysis

Use of #[phase(plugin, link)] causes the crate to be resolved twice. Looking at debug output, a bug is causing the two resolutions to load the same crate twice with separate cnums. I believe I have identified a fix and will be submitting a PR shortly.

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