From 3e309350d2dcac7f6e28754008fc899dea88bae9 Mon Sep 17 00:00:00 2001 From: Yoshiki Matsuda Date: Sun, 5 Jun 2022 22:26:20 +0900 Subject: [PATCH] add a comment about counting zero bytes --- compiler/rustc_metadata/src/rmeta/encoder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 0da87abbc48..d2157ebe7dc 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -735,6 +735,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { if tcx.sess.meta_stats() { self.opaque.flush(); + // Rewind and re-read all the metadata to count the zero bytes we wrote. let pos_before_rewind = self.opaque.file().stream_position().unwrap(); let mut zero_bytes = 0; self.opaque.file().rewind().unwrap();