@@ -40,7 +40,7 @@ use rustc_span::{
4040use rustc_target:: abi:: VariantIdx ;
4141use std:: borrow:: Borrow ;
4242use std:: hash:: Hash ;
43- use std:: io:: { Seek , Write } ;
43+ use std:: io:: { Read , Seek , Write } ;
4444use std:: iter;
4545use std:: num:: NonZeroUsize ;
4646use std:: path:: { Path , PathBuf } ;
@@ -734,26 +734,26 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
734734 assert_eq ! ( total_bytes, computed_total_bytes) ;
735735
736736 if tcx. sess . meta_stats ( ) {
737- // let mut zero_bytes = 0;
738- // for e in self.opaque.data.iter() {
739- // if *e == 0 {
740- // zero_bytes += 1;
741- // }
742- // }
737+ let mut zero_bytes = 0 ;
738+ let file = std:: io:: BufReader :: new ( self . opaque . file ( ) ) ;
739+ for e in file. bytes ( ) {
740+ if e. unwrap ( ) == 0 {
741+ zero_bytes += 1 ;
742+ }
743+ }
743744
744745 let perc = |bytes| ( bytes * 100 ) as f64 / total_bytes as f64 ;
745746 let p = |label, bytes| {
746747 eprintln ! ( "{:>21}: {:>8} bytes ({:4.1}%)" , label, bytes, perc( bytes) ) ;
747748 } ;
748749
749750 eprintln ! ( "" ) ;
750- // FIXME print zero bytes
751- //eprintln!(
752- // "{} metadata bytes, of which {} bytes ({:.1}%) are zero",
753- // total_bytes,
754- // zero_bytes,
755- // perc(zero_bytes)
756- //);
751+ eprintln ! (
752+ "{} metadata bytes, of which {} bytes ({:.1}%) are zero" ,
753+ total_bytes,
754+ zero_bytes,
755+ perc( zero_bytes)
756+ ) ;
757757 p ( "preamble" , preamble_bytes) ;
758758 p ( "dep" , dep_bytes) ;
759759 p ( "lib feature" , lib_feature_bytes) ;
0 commit comments