Skip to content

Commit 4207ff7

Browse files
committed
Test
1 parent d17b845 commit 4207ff7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

compiler/rustc_query_system/src/dep_graph/serialized.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ impl SerializedDepGraph {
272272
}
273273
}
274274

275+
assert_eq!(decoded_nodes, node_count);
276+
275277
// When we access the edge list data, we do a fixed-size read from the edge list data then
276278
// mask off the bytes that aren't for that edge index, so the last read may dangle off the
277279
// end of the array. This padding ensure it doesn't.
@@ -284,6 +286,8 @@ impl SerializedDepGraph {
284286

285287
let session_count = d.read_u64();
286288

289+
assert_eq!(d.read_u64(), 0x8375672356237834);
290+
287291
for (idx, node) in nodes.iter_enumerated() {
288292
if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
289293
// Empty nodes and side effect nodes can have duplicates
@@ -677,6 +681,8 @@ impl<D: Deps> EncoderState<D> {
677681
record_graph: &Option<Lock<DepGraphQuery>>,
678682
local: &mut LocalEncoderState,
679683
) {
684+
assert!(local.in_chunk);
685+
assert_ne!(node.node.kind, D::DEP_KIND_NULL);
680686
node.encode::<D>(&mut local.encoder);
681687
self.flush_mem_encoder(&mut *local);
682688
self.record(
@@ -705,6 +711,8 @@ impl<D: Deps> EncoderState<D> {
705711
local: &mut LocalEncoderState,
706712
) {
707713
let node = self.previous.index_to_node(prev_index);
714+
assert!(local.in_chunk);
715+
assert_ne!(node.kind, D::DEP_KIND_NULL);
708716
let fingerprint = self.previous.fingerprint_by_index(prev_index);
709717
let edge_count = NodeInfo::encode_promoted::<D>(
710718
&mut local.encoder,
@@ -777,6 +785,8 @@ impl<D: Deps> EncoderState<D> {
777785

778786
self.previous.session_count.checked_add(1).unwrap().encode(&mut encoder);
779787

788+
encoder.emit_u64(0x8375672356237834);
789+
780790
debug!(?node_max, ?node_count, ?edge_count);
781791
debug!("position: {:?}", encoder.position());
782792
IntEncodedWithFixedSize(node_max.try_into().unwrap()).encode(&mut encoder);

0 commit comments

Comments
 (0)