Rename loader.rs -> locator.rs.
This commit is contained in:
parent
92413c9cf4
commit
f3993d1a7f
6 changed files with 26 additions and 27 deletions
|
|
@ -77,7 +77,7 @@ use rustc::session::config::nightly_options;
|
|||
use rustc::session::early_error;
|
||||
use rustc::lint::Lint;
|
||||
use rustc::lint;
|
||||
use rustc_metadata::loader;
|
||||
use rustc_metadata::locator;
|
||||
use rustc_metadata::cstore::CStore;
|
||||
use rustc::util::common::time;
|
||||
|
||||
|
|
@ -578,8 +578,7 @@ impl RustcDefaultCalls {
|
|||
&Input::File(ref ifile) => {
|
||||
let path = &(*ifile);
|
||||
let mut v = Vec::new();
|
||||
loader::list_file_metadata(&sess.target.target, path, &mut v)
|
||||
.unwrap();
|
||||
locator::list_file_metadata(&sess.target.target, path, &mut v).unwrap();
|
||||
println!("{}", String::from_utf8(v).unwrap());
|
||||
}
|
||||
&Input::Str { .. } => {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//! Validates all used crates and extern libraries and loads their metadata
|
||||
|
||||
use cstore::{self, CStore, CrateSource, MetadataBlob};
|
||||
use loader::{self, CratePaths};
|
||||
use locator::{self, CratePaths};
|
||||
use macro_import;
|
||||
use schema::CrateRoot;
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ impl<'a> CrateLoader<'a> {
|
|||
Some(cnum) => LoadResult::Previous(cnum),
|
||||
None => {
|
||||
info!("falling back to a load");
|
||||
let mut load_ctxt = loader::Context {
|
||||
let mut locate_ctxt = locator::Context {
|
||||
sess: self.sess,
|
||||
span: span,
|
||||
ident: ident,
|
||||
|
|
@ -368,9 +368,9 @@ impl<'a> CrateLoader<'a> {
|
|||
rejected_via_version: vec!(),
|
||||
should_match_name: true,
|
||||
};
|
||||
match self.load(&mut load_ctxt) {
|
||||
match self.load(&mut locate_ctxt) {
|
||||
Some(result) => result,
|
||||
None => load_ctxt.report_load_errs(),
|
||||
None => locate_ctxt.report_errs(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -390,8 +390,8 @@ impl<'a> CrateLoader<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn load(&mut self, loader: &mut loader::Context) -> Option<LoadResult> {
|
||||
let library = match loader.maybe_load_library_crate() {
|
||||
fn load(&mut self, locate_ctxt: &mut locator::Context) -> Option<LoadResult> {
|
||||
let library = match locate_ctxt.maybe_load_library_crate() {
|
||||
Some(lib) => lib,
|
||||
None => return None,
|
||||
};
|
||||
|
|
@ -405,11 +405,11 @@ impl<'a> CrateLoader<'a> {
|
|||
// don't want to match a host crate against an equivalent target one
|
||||
// already loaded.
|
||||
let root = library.metadata.get_root();
|
||||
if loader.triple == self.sess.opts.target_triple {
|
||||
if locate_ctxt.triple == self.sess.opts.target_triple {
|
||||
let mut result = LoadResult::Loaded(library);
|
||||
self.cstore.iter_crate_data(|cnum, data| {
|
||||
if data.name() == root.name && root.hash == data.hash() {
|
||||
assert!(loader.hash.is_none());
|
||||
assert!(locate_ctxt.hash.is_none());
|
||||
info!("load success, going to previous cnum: {}", cnum);
|
||||
result = LoadResult::Previous(cnum);
|
||||
}
|
||||
|
|
@ -494,7 +494,7 @@ impl<'a> CrateLoader<'a> {
|
|||
let mut target_only = false;
|
||||
let ident = info.ident.clone();
|
||||
let name = info.name.clone();
|
||||
let mut load_ctxt = loader::Context {
|
||||
let mut locate_ctxt = locator::Context {
|
||||
sess: self.sess,
|
||||
span: span,
|
||||
ident: &ident[..],
|
||||
|
|
@ -510,7 +510,7 @@ impl<'a> CrateLoader<'a> {
|
|||
rejected_via_version: vec!(),
|
||||
should_match_name: true,
|
||||
};
|
||||
let library = self.load(&mut load_ctxt).or_else(|| {
|
||||
let library = self.load(&mut locate_ctxt).or_else(|| {
|
||||
if !is_cross {
|
||||
return None
|
||||
}
|
||||
|
|
@ -519,15 +519,15 @@ impl<'a> CrateLoader<'a> {
|
|||
target_only = true;
|
||||
should_link = info.should_link;
|
||||
|
||||
load_ctxt.target = &self.sess.target.target;
|
||||
load_ctxt.triple = target_triple;
|
||||
load_ctxt.filesearch = self.sess.target_filesearch(PathKind::Crate);
|
||||
locate_ctxt.target = &self.sess.target.target;
|
||||
locate_ctxt.triple = target_triple;
|
||||
locate_ctxt.filesearch = self.sess.target_filesearch(PathKind::Crate);
|
||||
|
||||
self.load(&mut load_ctxt)
|
||||
self.load(&mut locate_ctxt)
|
||||
});
|
||||
let library = match library {
|
||||
Some(l) => l,
|
||||
None => load_ctxt.report_load_errs(),
|
||||
None => locate_ctxt.report_errs(),
|
||||
};
|
||||
|
||||
let (dylib, metadata) = match library {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// The crate store - a central repo for information collected about external
|
||||
// crates and libraries
|
||||
|
||||
use loader;
|
||||
use locator;
|
||||
use schema;
|
||||
|
||||
use rustc::dep_graph::DepGraph;
|
||||
|
|
@ -43,7 +43,7 @@ pub type CrateNumMap = IndexVec<CrateNum, CrateNum>;
|
|||
|
||||
pub enum MetadataBlob {
|
||||
Inflated(Bytes),
|
||||
Archive(loader::ArchiveMetadata),
|
||||
Archive(locator::ArchiveMetadata),
|
||||
}
|
||||
|
||||
/// Holds information about a syntax_pos::FileMap imported from another crate.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use cstore;
|
||||
use encoder;
|
||||
use loader;
|
||||
use locator;
|
||||
use schema;
|
||||
|
||||
use rustc::middle::cstore::{InlinedItem, CrateStore, CrateSource, ExternCrate};
|
||||
|
|
@ -497,12 +497,12 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
|||
|
||||
fn metadata_filename(&self) -> &str
|
||||
{
|
||||
loader::METADATA_FILENAME
|
||||
locator::METADATA_FILENAME
|
||||
}
|
||||
|
||||
fn metadata_section_name(&self, target: &Target) -> &str
|
||||
{
|
||||
loader::meta_section_name(target)
|
||||
locator::meta_section_name(target)
|
||||
}
|
||||
|
||||
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, Option<PathBuf>)>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ mod schema;
|
|||
|
||||
pub mod creader;
|
||||
pub mod cstore;
|
||||
pub mod loader;
|
||||
pub mod locator;
|
||||
pub mod macro_import;
|
||||
|
||||
__build_diagnostic_array! { librustc_metadata, DIAGNOSTICS }
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@
|
|||
//!
|
||||
//! That's the general overview of loading crates in the compiler, but it's by
|
||||
//! no means all of the necessary details. Take a look at the rest of
|
||||
//! metadata::loader or metadata::creader for all the juicy details!
|
||||
//! metadata::locator or metadata::creader for all the juicy details!
|
||||
|
||||
use cstore::MetadataBlob;
|
||||
use creader::Library;
|
||||
|
|
@ -310,10 +310,10 @@ impl<'a> Context<'a> {
|
|||
}
|
||||
|
||||
pub fn load_library_crate(&mut self) -> Library {
|
||||
self.find_library_crate().unwrap_or_else(|| self.report_load_errs())
|
||||
self.find_library_crate().unwrap_or_else(|| self.report_errs())
|
||||
}
|
||||
|
||||
pub fn report_load_errs(&mut self) -> ! {
|
||||
pub fn report_errs(&mut self) -> ! {
|
||||
let add = match self.root {
|
||||
&None => String::new(),
|
||||
&Some(ref r) => format!(" which `{}` depends on",
|
||||
Loading…
Add table
Add a link
Reference in a new issue