Skip to content

Commit 80fe1d2

Browse files
committed
Rename loader.rs -> locator.rs.
1 parent 63f9314 commit 80fe1d2

File tree

6 files changed

+26
-27
lines changed

6 files changed

+26
-27
lines changed

src/librustc_driver/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use rustc::session::config::nightly_options;
7777
use rustc::session::early_error;
7878
use rustc::lint::Lint;
7979
use rustc::lint;
80-
use rustc_metadata::loader;
80+
use rustc_metadata::locator;
8181
use rustc_metadata::cstore::CStore;
8282
use rustc::util::common::time;
8383

@@ -578,8 +578,7 @@ impl RustcDefaultCalls {
578578
&Input::File(ref ifile) => {
579579
let path = &(*ifile);
580580
let mut v = Vec::new();
581-
loader::list_file_metadata(&sess.target.target, path, &mut v)
582-
.unwrap();
581+
locator::list_file_metadata(&sess.target.target, path, &mut v).unwrap();
583582
println!("{}", String::from_utf8(v).unwrap());
584583
}
585584
&Input::Str { .. } => {

src/librustc_metadata/creader.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! Validates all used crates and extern libraries and loads their metadata
1212
1313
use cstore::{self, CStore, CrateSource, MetadataBlob};
14-
use loader::{self, CratePaths};
14+
use locator::{self, CratePaths};
1515
use macro_import;
1616
use schema::CrateRoot;
1717

@@ -352,7 +352,7 @@ impl<'a> CrateLoader<'a> {
352352
Some(cnum) => LoadResult::Previous(cnum),
353353
None => {
354354
info!("falling back to a load");
355-
let mut load_ctxt = loader::Context {
355+
let mut locate_ctxt = locator::Context {
356356
sess: self.sess,
357357
span: span,
358358
ident: ident,
@@ -368,9 +368,9 @@ impl<'a> CrateLoader<'a> {
368368
rejected_via_version: vec!(),
369369
should_match_name: true,
370370
};
371-
match self.load(&mut load_ctxt) {
371+
match self.load(&mut locate_ctxt) {
372372
Some(result) => result,
373-
None => load_ctxt.report_load_errs(),
373+
None => locate_ctxt.report_errs(),
374374
}
375375
}
376376
};
@@ -390,8 +390,8 @@ impl<'a> CrateLoader<'a> {
390390
}
391391
}
392392

393-
fn load(&mut self, loader: &mut loader::Context) -> Option<LoadResult> {
394-
let library = match loader.maybe_load_library_crate() {
393+
fn load(&mut self, locate_ctxt: &mut locator::Context) -> Option<LoadResult> {
394+
let library = match locate_ctxt.maybe_load_library_crate() {
395395
Some(lib) => lib,
396396
None => return None,
397397
};
@@ -405,11 +405,11 @@ impl<'a> CrateLoader<'a> {
405405
// don't want to match a host crate against an equivalent target one
406406
// already loaded.
407407
let root = library.metadata.get_root();
408-
if loader.triple == self.sess.opts.target_triple {
408+
if locate_ctxt.triple == self.sess.opts.target_triple {
409409
let mut result = LoadResult::Loaded(library);
410410
self.cstore.iter_crate_data(|cnum, data| {
411411
if data.name() == root.name && root.hash == data.hash() {
412-
assert!(loader.hash.is_none());
412+
assert!(locate_ctxt.hash.is_none());
413413
info!("load success, going to previous cnum: {}", cnum);
414414
result = LoadResult::Previous(cnum);
415415
}
@@ -494,7 +494,7 @@ impl<'a> CrateLoader<'a> {
494494
let mut target_only = false;
495495
let ident = info.ident.clone();
496496
let name = info.name.clone();
497-
let mut load_ctxt = loader::Context {
497+
let mut locate_ctxt = locator::Context {
498498
sess: self.sess,
499499
span: span,
500500
ident: &ident[..],
@@ -510,7 +510,7 @@ impl<'a> CrateLoader<'a> {
510510
rejected_via_version: vec!(),
511511
should_match_name: true,
512512
};
513-
let library = self.load(&mut load_ctxt).or_else(|| {
513+
let library = self.load(&mut locate_ctxt).or_else(|| {
514514
if !is_cross {
515515
return None
516516
}
@@ -519,15 +519,15 @@ impl<'a> CrateLoader<'a> {
519519
target_only = true;
520520
should_link = info.should_link;
521521

522-
load_ctxt.target = &self.sess.target.target;
523-
load_ctxt.triple = target_triple;
524-
load_ctxt.filesearch = self.sess.target_filesearch(PathKind::Crate);
522+
locate_ctxt.target = &self.sess.target.target;
523+
locate_ctxt.triple = target_triple;
524+
locate_ctxt.filesearch = self.sess.target_filesearch(PathKind::Crate);
525525

526-
self.load(&mut load_ctxt)
526+
self.load(&mut locate_ctxt)
527527
});
528528
let library = match library {
529529
Some(l) => l,
530-
None => load_ctxt.report_load_errs(),
530+
None => locate_ctxt.report_errs(),
531531
};
532532

533533
let (dylib, metadata) = match library {

src/librustc_metadata/cstore.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// The crate store - a central repo for information collected about external
1212
// crates and libraries
1313

14-
use loader;
14+
use locator;
1515
use schema;
1616

1717
use rustc::dep_graph::DepGraph;
@@ -43,7 +43,7 @@ pub type CrateNumMap = IndexVec<CrateNum, CrateNum>;
4343

4444
pub enum MetadataBlob {
4545
Inflated(Bytes),
46-
Archive(loader::ArchiveMetadata),
46+
Archive(locator::ArchiveMetadata),
4747
}
4848

4949
/// Holds information about a syntax_pos::FileMap imported from another crate.

src/librustc_metadata/cstore_impl.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use cstore;
1212
use encoder;
13-
use loader;
13+
use locator;
1414
use schema;
1515

1616
use rustc::middle::cstore::{InlinedItem, CrateStore, CrateSource, ExternCrate};
@@ -497,12 +497,12 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
497497

498498
fn metadata_filename(&self) -> &str
499499
{
500-
loader::METADATA_FILENAME
500+
locator::METADATA_FILENAME
501501
}
502502

503503
fn metadata_section_name(&self, target: &Target) -> &str
504504
{
505-
loader::meta_section_name(target)
505+
locator::meta_section_name(target)
506506
}
507507

508508
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, Option<PathBuf>)>

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod schema;
5858

5959
pub mod creader;
6060
pub mod cstore;
61-
pub mod loader;
61+
pub mod locator;
6262
pub mod macro_import;
6363

6464
__build_diagnostic_array! { librustc_metadata, DIAGNOSTICS }

src/librustc_metadata/loader.rs renamed to src/librustc_metadata/locator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
//!
211211
//! That's the general overview of loading crates in the compiler, but it's by
212212
//! no means all of the necessary details. Take a look at the rest of
213-
//! metadata::loader or metadata::creader for all the juicy details!
213+
//! metadata::locator or metadata::creader for all the juicy details!
214214
215215
use cstore::MetadataBlob;
216216
use creader::Library;
@@ -310,10 +310,10 @@ impl<'a> Context<'a> {
310310
}
311311

312312
pub fn load_library_crate(&mut self) -> Library {
313-
self.find_library_crate().unwrap_or_else(|| self.report_load_errs())
313+
self.find_library_crate().unwrap_or_else(|| self.report_errs())
314314
}
315315

316-
pub fn report_load_errs(&mut self) -> ! {
316+
pub fn report_errs(&mut self) -> ! {
317317
let add = match self.root {
318318
&None => String::new(),
319319
&Some(ref r) => format!(" which `{}` depends on",

0 commit comments

Comments
 (0)