@@ -179,13 +179,15 @@ impl SerializedDepGraph {
179
179
pub fn decode < D : Deps > ( d : & mut MemDecoder < ' _ > ) -> SerializedDepGraph {
180
180
// The last 16 bytes are the node count and edge count.
181
181
debug ! ( "position: {:?}" , d. position( ) ) ;
182
- let ( node_count, edge_count) =
183
- d. with_position ( d. len ( ) - 2 * IntEncodedWithFixedSize :: ENCODED_SIZE , |d| {
182
+ let ( node_count, edge_count, graph_size ) =
183
+ d. with_position ( d. len ( ) - 3 * IntEncodedWithFixedSize :: ENCODED_SIZE , |d| {
184
184
debug ! ( "position: {:?}" , d. position( ) ) ;
185
185
let node_count = IntEncodedWithFixedSize :: decode ( d) . 0 as usize ;
186
186
let edge_count = IntEncodedWithFixedSize :: decode ( d) . 0 as usize ;
187
- ( node_count, edge_count)
187
+ let graph_size = IntEncodedWithFixedSize :: decode ( d) . 0 as usize ;
188
+ ( node_count, edge_count, graph_size)
188
189
} ) ;
190
+ assert_eq ! ( d. len( ) , graph_size) ;
189
191
debug ! ( "position: {:?}" , d. position( ) ) ;
190
192
191
193
debug ! ( ?node_count, ?edge_count) ;
@@ -491,6 +493,8 @@ impl<D: Deps> EncoderState<D> {
491
493
debug ! ( "position: {:?}" , encoder. position( ) ) ;
492
494
IntEncodedWithFixedSize ( node_count) . encode ( & mut encoder) ;
493
495
IntEncodedWithFixedSize ( edge_count) . encode ( & mut encoder) ;
496
+ let graph_size = encoder. position ( ) + IntEncodedWithFixedSize :: ENCODED_SIZE ;
497
+ IntEncodedWithFixedSize ( graph_size as u64 ) . encode ( & mut encoder) ;
494
498
debug ! ( "position: {:?}" , encoder. position( ) ) ;
495
499
// Drop the encoder so that nothing is written after the counts.
496
500
let result = encoder. finish ( ) ;
0 commit comments