Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e11dd80

Browse files
committed
seek before counting zero bytes
1 parent 1ead92d commit e11dd80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use rustc_span::{
4040
use rustc_target::abi::VariantIdx;
4141
use std::borrow::Borrow;
4242
use std::hash::Hash;
43-
use std::io::{Read, Write};
43+
use std::io::{Read, Seek, Write};
4444
use std::iter;
4545
use std::num::NonZeroUsize;
4646
use std::path::{Path, PathBuf};
@@ -735,6 +735,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
735735

736736
if tcx.sess.meta_stats() {
737737
let mut zero_bytes = 0;
738+
self.opaque.file().seek(std::io::SeekFrom::Start(0)).unwrap();
738739
let file = std::io::BufReader::new(self.opaque.file());
739740
for e in file.bytes() {
740741
if e.unwrap() == 0 {

0 commit comments

Comments
 (0)