From 0669abda4aa2a544ad8ab465fba0853ff8379c23 Mon Sep 17 00:00:00 2001 From: Jay Somedon Date: Thu, 24 Dec 2020 23:00:59 +0800 Subject: Revise error message regarding metadata version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Laurențiu Nicola --- crates/proc_macro_api/src/lib.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'crates') diff --git a/crates/proc_macro_api/src/lib.rs b/crates/proc_macro_api/src/lib.rs index 481fb6dee..8f0f141f7 100644 --- a/crates/proc_macro_api/src/lib.rs +++ b/crates/proc_macro_api/src/lib.rs @@ -76,10 +76,7 @@ impl ProcMacroClient { args: impl IntoIterator>, ) -> io::Result { let (thread, process) = ProcMacroProcessSrv::run(process_path, args)?; - Ok(ProcMacroClient { - process: Arc::new(process), - thread, - }) + Ok(ProcMacroClient { process: Arc::new(process), thread }) } pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec { @@ -106,11 +103,7 @@ impl ProcMacroClient { dylib_path: dylib_path.into(), }); - ProcMacro { - name, - kind, - expander, - } + ProcMacro { name, kind, expander } }) .collect() } @@ -156,7 +149,10 @@ impl ProcMacroClient { const EXPECTED_HEADER: [u8; 8] = [b'r', b'u', b's', b't', 0, 0, 0, 5]; // check if header is valid if header != EXPECTED_HEADER { - return Err(io::Error::new(io::ErrorKind::InvalidData, format!(".rustc section should start with header {:?}; header {:?} is actually presented.",EXPECTED_HEADER ,header))); + return Err(io::Error::new( + io::ErrorKind::InvalidData, + format!("only metadata version 5 is supported, section header was: {:?}", header), + )); } let snappy_portion = &dot_rustc[8..]; -- cgit v1.2.3