diff options
| author | Brian Koropoff <bkoropoff@gmail.com> | 2014-09-11 22:50:40 -0700 |
|---|---|---|
| committer | Brian Koropoff <bkoropoff@gmail.com> | 2014-09-11 23:10:44 -0700 |
| commit | 957229c21504c734c49a94f1685f82ac225df3e7 (patch) | |
| tree | bcfe6fa933fcc7fdc5bf2a6b1efc55ea9d286b62 | |
| parent | f9888ac33980aeb866fe2f904f2da436099136e5 (diff) | |
| download | rust-957229c21504c734c49a94f1685f82ac225df3e7.tar.gz rust-957229c21504c734c49a94f1685f82ac225df3e7.zip | |
Fix check for existing crate when using --extern
When checking for an existing crate, compare against the `crate_metadata::name` field, which is the crate name which was requested during resolution, rather than the result of the `crate_metadata::name()` method, which is the crate name within the crate metadata, as these may not match when using the --extern option to `rustc`. This fixes spurious "multiple crate version" warnings under the following scenario: - The crate `foo`, is referenced multiple times - `--extern foo=./path/to/libbar.rlib` is specified to rustc - The internal crate name of `libbar.rlib` is not `foo` The behavior surrounding `Context::should_match_name` and the comments in `loader.rs` both lead me to believe that this scenario is intended to work. Fixes #17186
| -rw-r--r-- | src/librustc/metadata/creader.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 9931f47a133..b551e9ce34f 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -281,7 +281,7 @@ fn existing_match(e: &Env, name: &str, hash: Option<&Svh>) -> Option<ast::CrateNum> { let mut ret = None; e.sess.cstore.iter_crate_data(|cnum, data| { - if data.name().as_slice() != name { return } + if data.name.as_slice() != name { return } match hash { Some(hash) if *hash == data.hash() => { ret = Some(cnum); return } |
