From cb0039e3b749350fc649f3d19cb964ee798c1ac8 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 18 May 2019 17:51:12 +0200 Subject: [PATCH] Misc changes to rustc_metadata --- src/librustc_metadata/creader.rs | 6 +++--- src/librustc_metadata/locator.rs | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 7f2a1c0b4b1d1..3e00ba3c62004 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -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(), diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 7d7dd1061a959..3832c8ee227de 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -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()));