Rollup merge of #60942 - bjorn3:metadata_loader_refactor, r=michaelwoerister

Misc changes to rustc_metadata
This commit is contained in:
Mazdak Farrokhzad 2019-05-20 23:03:03 +02:00 committed by GitHub
commit 65cec43ce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -95,7 +95,7 @@ enum LoadError<'a> {
impl<'a> LoadError<'a> {
fn report(self) -> ! {
match self {
LoadError::LocatorError(mut locate_ctxt) => locate_ctxt.report_errs(),
LoadError::LocatorError(locate_ctxt) => locate_ctxt.report_errs(),
}
}
}
@ -365,8 +365,8 @@ impl<'a> CrateLoader<'a> {
span,
ident,
crate_name: name,
hash: hash.map(|a| &*a),
extra_filename: extra_filename,
hash,
extra_filename,
filesearch: self.sess.target_filesearch(path_kind),
target: &self.sess.target.target,
triple: self.sess.opts.target_triple.clone(),

View File

@ -321,7 +321,7 @@ impl<'a> Context<'a> {
}
}
pub fn report_errs(&mut self) -> ! {
pub fn report_errs(self) -> ! {
let add = match self.root {
&None => String::new(),
&Some(ref r) => format!(" which `{}` depends on", r.ident),
@ -901,8 +901,7 @@ fn get_metadata_section_imp(target: &Target,
let mut inflated = Vec::new();
match DeflateDecoder::new(compressed_bytes).read_to_end(&mut inflated) {
Ok(_) => {
let buf = unsafe { OwningRef::new_assert_stable_address(inflated) };
rustc_erase_owner!(buf.map_owner_box())
rustc_erase_owner!(OwningRef::new(inflated).map_owner_box())
}
Err(_) => {
return Err(format!("failed to decompress metadata: {}", filename.display()));