Skip to content

Commit 094407a

Browse files
committed
feat(proc-macro-srv): support metadata version 10
Signed-off-by: Prajwal S N <[email protected]>
1 parent e02d76a commit 094407a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/proc-macro-srv/src/dylib/version.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn read_dylib_info(obj: &object::File<'_>) -> io::Result<RustCInfo> {
2727
let mut items = ver_str.split_whitespace();
2828
let tag = items.next().ok_or_else(|| err!("version format error"))?;
2929
if tag != "rustc" {
30-
return Err(err!("version format error (No rustc tag)"));
30+
return Err(err!("no rustc tag"));
3131
}
3232

3333
let version_part = items.next().ok_or_else(|| err!("no version string"))?;
@@ -83,7 +83,7 @@ fn read_section<'a>(obj: &object::File<'a>, section_name: &str) -> io::Result<&'
8383
/// A proc macro crate binary's ".rustc" section has following byte layout:
8484
/// * [b'r',b'u',b's',b't',0,0,0,5] is the first 8 bytes
8585
/// * ff060000 734e6150 is followed, it's the snappy format magic bytes,
86-
/// means bytes from here(including this sequence) are compressed in
86+
/// means bytes from here (including this sequence) are compressed in
8787
/// snappy compression format. Version info is inside here, so decompress
8888
/// this.
8989
///
@@ -110,15 +110,15 @@ pub fn read_version(obj: &object::File<'_>) -> io::Result<String> {
110110
));
111111
}
112112
let version = u32::from_be_bytes([dot_rustc[4], dot_rustc[5], dot_rustc[6], dot_rustc[7]]);
113-
// Last supported version is:
113+
// Last version with breaking changes is:
114114
// https://github.com/rust-lang/rust/commit/b94cfefc860715fb2adf72a6955423d384c69318
115115
let (mut metadata_portion, bytes_before_version) = match version {
116116
8 => {
117117
let len_bytes = &dot_rustc[8..12];
118118
let data_len = u32::from_be_bytes(len_bytes.try_into().unwrap()) as usize;
119119
(&dot_rustc[12..data_len + 12], 13)
120120
}
121-
9 => {
121+
9 | 10 => {
122122
let len_bytes = &dot_rustc[8..16];
123123
let data_len = u64::from_le_bytes(len_bytes.try_into().unwrap()) as usize;
124124
(&dot_rustc[16..data_len + 12], 17)

0 commit comments

Comments
 (0)