use crate::creader::Library;
use crate::rmeta::{rustc_version, MetadataBlob, METADATA_HEADER};
-use rustc::middle::cstore::{CrateSource, MetadataLoader};
-use rustc::session::filesearch::{FileDoesntMatch, FileMatches, FileSearch};
-use rustc::session::search_paths::PathKind;
-use rustc::session::{config, CrateDisambiguator, Session};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::MetadataRef;
use rustc_errors::{struct_span_err, DiagnosticBuilder};
+use rustc_middle::middle::cstore::{CrateSource, MetadataLoader};
+use rustc_session::filesearch::{FileDoesntMatch, FileMatches, FileSearch};
+use rustc_session::search_paths::PathKind;
+use rustc_session::{config, CrateDisambiguator, Session};
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use rustc_target::spec::{Target, TargetTriple};
.into_iter()
.filter_map(|entry| entry.files())
.flatten()
- .map(|location| PathBuf::from(location))
+ .map(PathBuf::from)
.collect()
} else {
// SVH being specified means this is a transitive dependency,
// of the crate id (path/name/id).
//
// The goal of this step is to look at as little metadata as possible.
- self.filesearch.search(|path, kind| {
- let file = match path.file_name().and_then(|s| s.to_str()) {
+ self.filesearch.search(|spf, kind| {
+ let file = match &spf.file_name_str {
None => return FileDoesntMatch,
Some(file) => file,
};
(&file[(dylib_prefix.len())..(file.len() - dypair.1.len())], CrateFlavor::Dylib)
} else {
if file.starts_with(&staticlib_prefix) && file.ends_with(&staticpair.1) {
- staticlibs.push(CrateMismatch {
- path: path.to_path_buf(),
- got: "static".to_string(),
- });
+ staticlibs
+ .push(CrateMismatch { path: spf.path.clone(), got: "static".to_string() });
}
return FileDoesntMatch;
};
- info!("lib candidate: {}", path.display());
+ info!("lib candidate: {}", spf.path.display());
let hash_str = hash.to_string();
let slot = candidates.entry(hash_str).or_default();
let (ref mut rlibs, ref mut rmetas, ref mut dylibs) = *slot;
- fs::canonicalize(path)
+ fs::canonicalize(&spf.path)
.map(|p| {
if seen_paths.contains(&p) {
return FileDoesntMatch;
let start = Instant::now();
let ret = get_metadata_section_imp(target, flavor, filename, loader);
info!("reading {:?} => {:?}", filename.file_name().unwrap(), start.elapsed());
- return ret;
+ ret
}
/// A trivial wrapper for `Mmap` that implements `StableDeref`.