]> git.lizzy.rs Git - rust.git/commit
rustc: Fix `extern crate` being order dependent
authorAlex Crichton <alex@alexcrichton.com>
Wed, 21 Oct 2015 04:05:39 +0000 (21:05 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 20 Nov 2015 18:58:38 +0000 (10:58 -0800)
commit24311d076267b40fed222dd661eb179f4613be74
tree58800a9d458b61d02989f8ade21c297a7e96ca1e
parent19020210321b08f136349968a8d868f789445090
rustc: Fix `extern crate` being order dependent

This commit fixes a bug where a crate could fail to compile depending on the
order of `extern crate` directives at the top of the crate. Specifically, if the
same crate is found at two locations, then if it's loaded first via `--extern`
it will not emit a duplicate warning, but if it's first loaded transitively
via a dep and *then* via `--extern` an error will be emitted.

The loader was tweaked to catch this scenario and coalesce the loading of these
two crates to prevent errors from being emitted.
src/librustc/metadata/creader.rs
src/librustc/metadata/loader.rs
src/test/run-make/extern-multiple-copies/Makefile [new file with mode: 0644]
src/test/run-make/extern-multiple-copies/bar.rs [new file with mode: 0644]
src/test/run-make/extern-multiple-copies/foo1.rs [new file with mode: 0644]
src/test/run-make/extern-multiple-copies/foo2.rs [new file with mode: 0644]