rustc_driver: Remove unnecessary use of crate store

This commit is contained in:
Vadim Petrochenkov 2019-10-16 19:03:21 +03:00
parent 8e0007f829
commit 2c16f84490
2 changed files with 7 additions and 7 deletions

View File

@ -36,11 +36,11 @@ use rustc::session::config::nightly_options;
use rustc::session::{early_error, early_warn};
use rustc::lint::Lint;
use rustc::lint;
use rustc::middle::cstore::MetadataLoader;
use rustc::hir::def_id::LOCAL_CRATE;
use rustc::ty::TyCtxt;
use rustc::util::common::{set_time_depth, time, print_time_passes_entry, ErrorReported};
use rustc_metadata::locator;
use rustc_metadata::cstore::CStore;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use rustc_interface::interface;
use rustc_interface::util::get_codegen_sysroot;
@ -277,7 +277,7 @@ pub fn run_compiler(
compiler.output_file(),
).and_then(|| RustcDefaultCalls::list_metadata(
sess,
compiler.cstore(),
&*compiler.codegen_backend().metadata_loader(),
&matches,
compiler.input()
));
@ -614,7 +614,7 @@ fn show_content_with_pager(content: &String) {
impl RustcDefaultCalls {
pub fn list_metadata(sess: &Session,
cstore: &CStore,
metadata_loader: &dyn MetadataLoader,
matches: &getopts::Matches,
input: &Input)
-> Compilation {
@ -626,7 +626,7 @@ impl RustcDefaultCalls {
let mut v = Vec::new();
locator::list_file_metadata(&sess.target.target,
path,
cstore,
metadata_loader,
&mut v)
.unwrap();
println!("{}", String::from_utf8(v).unwrap());

View File

@ -212,7 +212,7 @@
//! no means all of the necessary details. Take a look at the rest of
//! metadata::locator or metadata::creader for all the juicy details!
use crate::cstore::{MetadataBlob, CStore};
use crate::cstore::MetadataBlob;
use crate::creader::Library;
use crate::schema::{METADATA_HEADER, rustc_version};
@ -914,7 +914,7 @@ fn get_metadata_section_imp(target: &Target,
/// A diagnostic function for dumping crate metadata to an output stream.
pub fn list_file_metadata(target: &Target,
path: &Path,
cstore: &CStore,
metadata_loader: &dyn MetadataLoader,
out: &mut dyn io::Write)
-> io::Result<()> {
let filename = path.file_name().unwrap().to_str().unwrap();
@ -925,7 +925,7 @@ pub fn list_file_metadata(target: &Target,
} else {
CrateFlavor::Dylib
};
match get_metadata_section(target, flavor, path, &*cstore.metadata_loader) {
match get_metadata_section(target, flavor, path, metadata_loader) {
Ok(metadata) => metadata.list_crate_metadata(out),
Err(msg) => write!(out, "{}\n", msg),
}