]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_metadata/locator.rs
Rollup merge of #53470 - bjorn3:warn_metadata_errors, r=alexcrichton
[rust.git] / src / librustc_metadata / locator.rs
index f78a19403acf8b06cf2ae638cf63c12d1bcc152b..adff34af61ed8e9bd98a0566409d185849f55408 100644 (file)
 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};
@@ -308,7 +308,7 @@ fn paths(&self) -> Vec<PathBuf> {
 
 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)),
@@ -431,14 +431,19 @@ pub fn report_errs(&mut self) -> ! {
 
     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;
         }
@@ -617,7 +622,7 @@ fn extract_one(&mut self,
                         }
                     }
                     Err(err) => {
-                        info!("no metadata found: {}", err);
+                        warn!("no metadata found: {}", err);
                         continue;
                     }
                 };