aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJay Somedon <[email protected]>2020-12-24 15:00:59 +0000
committerEdwin Cheng <[email protected]>2021-03-04 01:15:28 +0000
commit0669abda4aa2a544ad8ab465fba0853ff8379c23 (patch)
tree0dc074554f814192b2c37a65f401029a39f64a5f /crates
parenta8f7326ee58185e3b2b95076b8542ef6afc80a5f (diff)
Revise error message regarding metadata version
Co-authored-by: LaurenČ›iu Nicola <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/proc_macro_api/src/lib.rs16
1 files changed, 6 insertions, 10 deletions
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 {
76 args: impl IntoIterator<Item = impl AsRef<OsStr>>, 76 args: impl IntoIterator<Item = impl AsRef<OsStr>>,
77 ) -> io::Result<ProcMacroClient> { 77 ) -> io::Result<ProcMacroClient> {
78 let (thread, process) = ProcMacroProcessSrv::run(process_path, args)?; 78 let (thread, process) = ProcMacroProcessSrv::run(process_path, args)?;
79 Ok(ProcMacroClient { 79 Ok(ProcMacroClient { process: Arc::new(process), thread })
80 process: Arc::new(process),
81 thread,
82 })
83 } 80 }
84 81
85 pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<ProcMacro> { 82 pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<ProcMacro> {
@@ -106,11 +103,7 @@ impl ProcMacroClient {
106 dylib_path: dylib_path.into(), 103 dylib_path: dylib_path.into(),
107 }); 104 });
108 105
109 ProcMacro { 106 ProcMacro { name, kind, expander }
110 name,
111 kind,
112 expander,
113 }
114 }) 107 })
115 .collect() 108 .collect()
116 } 109 }
@@ -156,7 +149,10 @@ impl ProcMacroClient {
156 const EXPECTED_HEADER: [u8; 8] = [b'r', b'u', b's', b't', 0, 0, 0, 5]; 149 const EXPECTED_HEADER: [u8; 8] = [b'r', b'u', b's', b't', 0, 0, 0, 5];
157 // check if header is valid 150 // check if header is valid
158 if header != EXPECTED_HEADER { 151 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 ));
160 } 156 }
161 157
162 let snappy_portion = &dot_rustc[8..]; 158 let snappy_portion = &dot_rustc[8..];