]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_query_system/src/dep_graph/serialized.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / compiler / rustc_query_system / src / dep_graph / serialized.rs
index c95dff13d6615ffe71097d8f480fad6097a7f9c6..1f8d87a7e913fc3ced081d5b717174b3ac14ef7a 100644 (file)
@@ -7,7 +7,7 @@
 //! The serialisation is performed on-demand when each node is emitted. Using this
 //! scheme, we do not need to keep the current graph in memory.
 //!
-//! The deserisalisation is performed manually, in order to convert from the stored
+//! The deserialization is performed manually, in order to convert from the stored
 //! sequence of NodeInfos to the different arrays in SerializedDepGraph.  Since the
 //! node and edge count are stored at the end of the file, all the arrays can be
 //! pre-allocated with the right length.
@@ -122,29 +122,24 @@ impl<'a, K: DepKind + Decodable<opaque::Decoder<'a>>> Decodable<opaque::Decoder<
         let mut edge_list_data = Vec::with_capacity(edge_count);
 
         for _index in 0..node_count {
-            d.read_struct(|d| {
-                let dep_node: DepNode<K> = d.read_struct_field("node", Decodable::decode);
-                let _i: SerializedDepNodeIndex = nodes.push(dep_node);
-                debug_assert_eq!(_i.index(), _index);
-
-                let fingerprint: Fingerprint =
-                    d.read_struct_field("fingerprint", Decodable::decode);
-                let _i: SerializedDepNodeIndex = fingerprints.push(fingerprint);
-                debug_assert_eq!(_i.index(), _index);
-
-                d.read_struct_field("edges", |d| {
-                    d.read_seq(|d, len| {
-                        let start = edge_list_data.len().try_into().unwrap();
-                        for _ in 0..len {
-                            let edge = d.read_seq_elt(Decodable::decode);
-                            edge_list_data.push(edge);
-                        }
-                        let end = edge_list_data.len().try_into().unwrap();
-                        let _i: SerializedDepNodeIndex = edge_list_indices.push((start, end));
-                        debug_assert_eq!(_i.index(), _index);
-                    })
-                })
-            });
+            let dep_node: DepNode<K> = Decodable::decode(d);
+            let _i: SerializedDepNodeIndex = nodes.push(dep_node);
+            debug_assert_eq!(_i.index(), _index);
+
+            let fingerprint: Fingerprint = Decodable::decode(d);
+            let _i: SerializedDepNodeIndex = fingerprints.push(fingerprint);
+            debug_assert_eq!(_i.index(), _index);
+
+            // Deserialize edges -- sequence of DepNodeIndex
+            let len = d.read_usize();
+            let start = edge_list_data.len().try_into().unwrap();
+            for _ in 0..len {
+                let edge = Decodable::decode(d);
+                edge_list_data.push(edge);
+            }
+            let end = edge_list_data.len().try_into().unwrap();
+            let _i: SerializedDepNodeIndex = edge_list_indices.push((start, end));
+            debug_assert_eq!(_i.index(), _index);
         }
 
         let index: FxHashMap<_, _> =
@@ -186,7 +181,6 @@ impl<K: DepKind> EncoderState<K> {
         }
     }
 
-    #[instrument(level = "debug", skip(self, record_graph))]
     fn encode_node(
         &mut self,
         node: &NodeInfo<K>,
@@ -213,7 +207,6 @@ impl<K: DepKind> EncoderState<K> {
             stat.edge_counter += edge_count as u64;
         }
 
-        debug!(?index, ?node);
         let encoder = &mut self.encoder;
         if self.result.is_ok() {
             self.result = node.encode(encoder);