File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
crates/proc-macro-api/src Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -120,17 +120,20 @@ pub fn read_version(dylib_path: &AbsPath) -> io::Result<String> {
120
120
let version = u32:: from_be_bytes ( [ dot_rustc[ 4 ] , dot_rustc[ 5 ] , dot_rustc[ 6 ] , dot_rustc[ 7 ] ] ) ;
121
121
// Last supported version is:
122
122
// https://github.com/rust-lang/rust/commit/0696e79f2740ad89309269b460579e548a5cd632
123
- match version {
124
- 5 | 6 => { }
123
+ let snappy_portion = match version {
124
+ 5 | 6 => & dot_rustc[ 8 ..] ,
125
+ 7 => {
126
+ let len_bytes = & dot_rustc[ 8 ..12 ] ;
127
+ let data_len = u32:: from_be_bytes ( len_bytes. try_into ( ) . unwrap ( ) ) as usize ;
128
+ & dot_rustc[ 12 ..data_len + 12 ]
129
+ }
125
130
_ => {
126
131
return Err ( io:: Error :: new (
127
132
io:: ErrorKind :: InvalidData ,
128
133
format ! ( "unsupported metadata version {version}" ) ,
129
134
) ) ;
130
135
}
131
- }
132
-
133
- let snappy_portion = & dot_rustc[ 8 ..] ;
136
+ } ;
134
137
135
138
let mut snappy_decoder = SnapDecoder :: new ( snappy_portion) ;
136
139
You can’t perform that action at this time.
0 commit comments