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> {
110110
111111 crate fn write_index ( & self , buf : & mut Encoder ) -> Lazy < [ Self ] > {
112112 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.
117113 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 )
119115 }
120116}
121117
@@ -124,12 +120,12 @@ impl Lazy<[Index<'tcx>]> {
124120 /// DefIndex (if any).
125121 #[ inline( never) ]
126122 crate fn lookup ( & self , bytes : & [ u8 ] , def_index : DefIndex ) -> Option < Lazy < Entry < ' tcx > > > {
127- let bytes = & bytes[ self . position ..] ;
128123 debug ! ( "Index::lookup: index={:?} len={:?}" ,
129124 def_index,
130125 self . meta) ;
131126
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 ( ) ) ;
133129 if position == u32:: MAX {
134130 debug ! ( "Index::lookup: position=u32::MAX" ) ;
135131 None
You can’t perform that action at this time.
0 commit comments