diff options
| author | bors <bors@rust-lang.org> | 2023-02-14 20:03:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-14 20:03:09 +0000 |
| commit | 89b994049147e6ed947c8ee5a29547be448874a0 (patch) | |
| tree | 8e3b79af2212e41cc36d4bcd5a34af06bd4df30f | |
| parent | 37608f306ccb9acf63734d750059b8607a1f5f56 (diff) | |
| parent | 853f0472454aca14f9fe39b06895b3d5b90c86f7 (diff) | |
| download | rust-89b994049147e6ed947c8ee5a29547be448874a0.tar.gz rust-89b994049147e6ed947c8ee5a29547be448874a0.zip | |
Auto merge of #14153 - CraftSpider:v7-metadata, r=CraftSpider
Add v7 metadata support to rust-analyzer Paired to https://github.com/rust-lang/rust/pull/101550
| -rw-r--r-- | crates/proc-macro-api/src/version.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/proc-macro-api/src/version.rs b/crates/proc-macro-api/src/version.rs index 40125c2a512..cf637ec359a 100644 --- a/crates/proc-macro-api/src/version.rs +++ b/crates/proc-macro-api/src/version.rs @@ -120,17 +120,20 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> { let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]); // Last supported version is: // https://github.com/rust-lang/rust/commit/0696e79f2740ad89309269b460579e548a5cd632 - match version { - 5 | 6 => {} + let snappy_portion = match version { + 5 | 6 => &dot_rustc[8..], + 7 => { + let len_bytes = &dot_rustc[8..12]; + let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize; + &dot_rustc[12..data_len + 12] + } _ => { return Err(io::Error::new( io::ErrorKind::InvalidData, format!("unsupported metadata version {version}"), )); } - } - - let snappy_portion = &dot_rustc[8..]; + }; let mut snappy_decoder = SnapDecoder::new(snappy_portion); |
