File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -110,12 +110,8 @@ impl Index<'tcx> {
110
110
111
111
crate fn write_index ( & self , buf : & mut Encoder ) -> Lazy < [ Self ] > {
112
112
let pos = buf. position ( ) ;
113
-
114
- // First we write the length of the lower range ...
115
- buf. emit_raw_bytes ( & ( self . positions . len ( ) as u32 / 4 ) . to_le_bytes ( ) ) ;
116
- // ... then the values.
117
113
buf. emit_raw_bytes ( & self . positions ) ;
118
- Lazy :: from_position_and_meta ( pos as usize , self . positions . len ( ) / 4 + 1 )
114
+ Lazy :: from_position_and_meta ( pos as usize , self . positions . len ( ) / 4 )
119
115
}
120
116
}
121
117
@@ -124,12 +120,12 @@ impl Lazy<[Index<'tcx>]> {
124
120
/// DefIndex (if any).
125
121
#[ inline( never) ]
126
122
crate fn lookup ( & self , bytes : & [ u8 ] , def_index : DefIndex ) -> Option < Lazy < Entry < ' tcx > > > {
127
- let bytes = & bytes[ self . position ..] ;
128
123
debug ! ( "Index::lookup: index={:?} len={:?}" ,
129
124
def_index,
130
125
self . meta) ;
131
126
132
- let position = u32:: read_from_bytes_at ( bytes, 1 + def_index. index ( ) ) ;
127
+ let bytes = & bytes[ self . position ..] [ ..self . meta * 4 ] ;
128
+ let position = u32:: read_from_bytes_at ( bytes, def_index. index ( ) ) ;
133
129
if position == u32:: MAX {
134
130
debug ! ( "Index::lookup: position=u32::MAX" ) ;
135
131
None
You can’t perform that action at this time.
0 commit comments