diff options
| author | Ben Kimock <kimockb@gmail.com> | 2024-05-03 21:17:57 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2024-05-21 20:12:29 -0400 |
| commit | 95150d72465db491f4b04b73545e106462bd003b (patch) | |
| tree | 99ebc1f9f9f08d0ff0065ac0a05fd60bbfb74eb2 /compiler/rustc_query_system/src | |
| parent | 39e02f1bd1e53d009da382654139f7c0639172a8 (diff) | |
| download | rust-95150d72465db491f4b04b73545e106462bd003b.tar.gz rust-95150d72465db491f4b04b73545e106462bd003b.zip | |
Add a footer in FileEncoder and check for it in MemDecoder
Diffstat (limited to 'compiler/rustc_query_system/src')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/serialized.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index b426bb888f4..8e91d9dd60b 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -182,15 +182,13 @@ impl SerializedDepGraph { pub fn decode<D: Deps>(d: &mut MemDecoder<'_>) -> Arc<SerializedDepGraph> { // The last 16 bytes are the node count and edge count. debug!("position: {:?}", d.position()); - let (node_count, edge_count, graph_size) = - d.with_position(d.len() - 3 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| { + let (node_count, edge_count) = + d.with_position(d.len() - 2 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| { debug!("position: {:?}", d.position()); let node_count = IntEncodedWithFixedSize::decode(d).0 as usize; let edge_count = IntEncodedWithFixedSize::decode(d).0 as usize; - let graph_size = IntEncodedWithFixedSize::decode(d).0 as usize; - (node_count, edge_count, graph_size) + (node_count, edge_count) }); - assert_eq!(d.len(), graph_size); debug!("position: {:?}", d.position()); debug!(?node_count, ?edge_count); @@ -606,8 +604,6 @@ impl<D: Deps> EncoderState<D> { debug!("position: {:?}", encoder.position()); IntEncodedWithFixedSize(node_count).encode(&mut encoder); IntEncodedWithFixedSize(edge_count).encode(&mut encoder); - let graph_size = encoder.position() + IntEncodedWithFixedSize::ENCODED_SIZE; - IntEncodedWithFixedSize(graph_size as u64).encode(&mut encoder); debug!("position: {:?}", encoder.position()); // Drop the encoder so that nothing is written after the counts. let result = encoder.finish(); |
