diff options
| author | bors <bors@rust-lang.org> | 2015-01-16 19:17:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-16 19:17:30 +0000 |
| commit | 653e6880c96f858ff1d9a42b525bf3a903ae94c8 (patch) | |
| tree | 5401c45e403276971bf3660aa0376e1006cc144e /src/rustllvm/RustWrapper.cpp | |
| parent | 210f0dcf007104240b2e286ed0b80cb4a61d7bae (diff) | |
| parent | cbeb77ec7a42b988703fa0b0c857f26d464fdc2f (diff) | |
| download | rust-653e6880c96f858ff1d9a42b525bf3a903ae94c8.tar.gz rust-653e6880c96f858ff1d9a42b525bf3a903ae94c8.zip | |
auto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brson
With the addition of separate search paths to the compiler, it was intended that
applications such as Cargo could require a `--extern` flag per `extern crate`
directive in the source. The system can currently be subverted, however, due to
the `existing_match()` logic in the crate loader.
When loading crates we first attempt to match an `extern crate` directive
against all previously loaded crates to avoid reading metadata twice. This "hit
the cache if possible" step was erroneously leaking crates across the search
path boundaries, however. For example:
extern crate b;
extern crate a;
If `b` depends on `a`, then it will load crate `a` when the `extern crate b`
directive is being processed. When the compiler reaches `extern crate a` it will
use the previously loaded version no matter what. If the compiler was not
invoked with `-L crate=path/to/a`, it will still succeed.
This behavior is allowing `extern crate` declarations in Cargo without a
corresponding declaration in the manifest of a dependency, which is considered
a bug.
This commit fixes this problem by keeping track of the origin search path for a
crate. Crates loaded from the dependency search path are not candidates for
crates which are loaded from the crate search path.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
