File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/tools/rust-analyzer/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> {
120120 let version = u32:: from_be_bytes ( [ dot_rustc[ 4 ] , dot_rustc[ 5 ] , dot_rustc[ 6 ] , dot_rustc[ 7 ] ] ) ;
121121 // Last supported version is:
122122 // 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+ }
125130 _ => {
126131 return Err ( io:: Error :: new (
127132 io:: ErrorKind :: InvalidData ,
128133 format ! ( "unsupported metadata version {version}" ) ,
129134 ) ) ;
130135 }
131- }
132-
133- let snappy_portion = & dot_rustc[ 8 ..] ;
136+ } ;
134137
135138 let mut snappy_decoder = SnapDecoder :: new ( snappy_portion) ;
136139
You can’t perform that action at this time.
0 commit comments