Skip to content

Commit e59f65c

Browse files
authored
Rollup merge of #46728 - varkor:contrib-4, r=michaelwoerister
Fix division-by-zero ICE in -Z perf-stats An invalid average now simply prints “N/A”. Fixes #46725.
2 parents 710e32a + 7b5981a commit e59f65c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustc/session/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,13 @@ impl Session {
635635
self.perf_stats.incr_comp_hashes_count.get());
636636
println!("Total number of bytes hashed for incr. comp.: {}",
637637
self.perf_stats.incr_comp_bytes_hashed.get());
638-
println!("Average bytes hashed per incr. comp. HIR node: {}",
639-
self.perf_stats.incr_comp_bytes_hashed.get() /
640-
self.perf_stats.incr_comp_hashes_count.get());
638+
if self.perf_stats.incr_comp_hashes_count.get() != 0 {
639+
println!("Average bytes hashed per incr. comp. HIR node: {}",
640+
self.perf_stats.incr_comp_bytes_hashed.get() /
641+
self.perf_stats.incr_comp_hashes_count.get());
642+
} else {
643+
println!("Average bytes hashed per incr. comp. HIR node: N/A");
644+
}
641645
println!("Total time spent computing symbol hashes: {}",
642646
duration_to_secs_str(self.perf_stats.symbol_hash_time.get()));
643647
println!("Total time spent decoding DefPath tables: {}",

0 commit comments

Comments
 (0)