use creader::Library;
use schema::{METADATA_HEADER, rustc_version};
+use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::svh::Svh;
use rustc::middle::cstore::MetadataLoader;
use rustc::session::{config, Session};
use rustc_target::spec::{Target, TargetTriple};
use std::cmp;
-use std::collections::HashSet;
use std::fmt;
use std::fs;
use std::io::{self, Read};
impl<'a> Context<'a> {
pub fn maybe_load_library_crate(&mut self) -> Option<Library> {
- let mut seen_paths = HashSet::new();
+ let mut seen_paths = FxHashSet::default();
match self.extra_filename {
Some(s) => self.find_library_crate(s, &mut seen_paths)
.or_else(|| self.find_library_crate("", &mut seen_paths)),
fn find_library_crate(&mut self,
extra_prefix: &str,
- seen_paths: &mut HashSet<PathBuf>)
+ seen_paths: &mut FxHashSet<PathBuf>)
-> Option<Library> {
// If an SVH is specified, then this is a transitive dependency that
// must be loaded via -L plus some filtering.
if self.hash.is_none() {
self.should_match_name = false;
if let Some(s) = self.sess.opts.externs.get(&self.crate_name.as_str()) {
- return self.find_commandline_library(s.iter());
+ // Only use `--extern crate_name=path` here, not `--extern crate_name`.
+ if s.iter().any(|l| l.is_some()) {
+ return self.find_commandline_library(
+ s.iter().filter_map(|l| l.as_ref()),
+ );
+ }
}
self.should_match_name = true;
}
}
}
Err(err) => {
- info!("no metadata found: {}", err);
+ warn!("no metadata found: {}", err);
continue;
}
};