Skip to content

Commit 0669abd

Browse files
jsomedonlnicola
authored andcommitted
Revise error message regarding metadata version
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
1 parent a8f7326 commit 0669abd

File tree

1 file changed

+6
-10
lines changed
  • crates/proc_macro_api/src

1 file changed

+6
-10
lines changed

crates/proc_macro_api/src/lib.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ impl ProcMacroClient {
7676
args: impl IntoIterator<Item = impl AsRef<OsStr>>,
7777
) -> io::Result<ProcMacroClient> {
7878
let (thread, process) = ProcMacroProcessSrv::run(process_path, args)?;
79-
Ok(ProcMacroClient {
80-
process: Arc::new(process),
81-
thread,
82-
})
79+
Ok(ProcMacroClient { process: Arc::new(process), thread })
8380
}
8481

8582
pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<ProcMacro> {
@@ -106,11 +103,7 @@ impl ProcMacroClient {
106103
dylib_path: dylib_path.into(),
107104
});
108105

109-
ProcMacro {
110-
name,
111-
kind,
112-
expander,
113-
}
106+
ProcMacro { name, kind, expander }
114107
})
115108
.collect()
116109
}
@@ -156,7 +149,10 @@ impl ProcMacroClient {
156149
const EXPECTED_HEADER: [u8; 8] = [b'r', b'u', b's', b't', 0, 0, 0, 5];
157150
// check if header is valid
158151
if header != EXPECTED_HEADER {
159-
return Err(io::Error::new(io::ErrorKind::InvalidData, format!(".rustc section should start with header {:?}; header {:?} is actually presented.",EXPECTED_HEADER ,header)));
152+
return Err(io::Error::new(
153+
io::ErrorKind::InvalidData,
154+
format!("only metadata version 5 is supported, section header was: {:?}", header),
155+
));
160156
}
161157

162158
let snappy_portion = &dot_rustc[8..];

0 commit comments

Comments
 (0)