Skip to content
Permalink
Browse files

rustc_metadata: Privatize `CrateMetadata::source`

  • Loading branch information
petrochenkov committed Nov 23, 2019
1 parent e241485 commit 32aa58c96bf7d61c03838f9ec75f3e4d26974832
Showing with 10 additions and 6 deletions.
  1. +5 −5 src/librustc_metadata/creader.rs
  2. +5 −1 src/librustc_metadata/rmeta/decoder.rs
@@ -51,10 +51,10 @@ fn dump_crates(cstore: &CStore) {
info!(" cnum: {}", cnum);
info!(" hash: {}", data.root.hash);
info!(" reqd: {:?}", *data.dep_kind.lock());
let CrateSource { dylib, rlib, rmeta } = data.source.clone();
dylib.map(|dl| info!(" dylib: {}", dl.0.display()));
rlib.map(|rl| info!(" rlib: {}", rl.0.display()));
rmeta.map(|rl| info!(" rmeta: {}", rl.0.display()));
let CrateSource { dylib, rlib, rmeta } = data.source();
dylib.as_ref().map(|dl| info!(" dylib: {}", dl.0.display()));
rlib.as_ref().map(|rl| info!(" rlib: {}", rl.0.display()));
rmeta.as_ref().map(|rl| info!(" rmeta: {}", rl.0.display()));
});
}

@@ -118,7 +118,7 @@ impl<'a> CrateLoader<'a> {
// We're also sure to compare *paths*, not actual byte slices. The
// `source` stores paths which are normalized which may be different
// from the strings on the command line.
let source = &self.cstore.get_crate_data(cnum).source;
let source = self.cstore.get_crate_data(cnum).source();
if let Some(entry) = self.sess.opts.externs.get(&name.as_str()) {
// Only use `--extern crate_name=path` here, not `--extern crate_name`.
let found = entry.locations.iter().filter_map(|l| l.as_ref()).any(|l| {
@@ -101,7 +101,7 @@ crate struct CrateMetadata {
/// How to link (or not link) this crate to the currently compiled crate.
crate dep_kind: Lock<DepKind>,
/// Filesystem location of this crate.
crate source: CrateSource,
source: CrateSource,
/// Whether or not this crate should be consider a private dependency
/// for purposes of the 'exported_private_dependencies' lint
private_dep: bool,
@@ -1534,6 +1534,10 @@ impl<'a, 'tcx> CrateMetadata {
}
update
}

crate fn source(&self) -> &CrateSource {
&self.source
}
}

// Cannot be implemented on 'ProcMacro', as libproc_macro

0 comments on commit 32aa58c

Please sign in to comment.
You can’t perform that action at this time.