diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2017-12-15 09:27:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-15 09:27:02 -0500 |
| commit | e59f65c36e68b01d1aad3faf81e59cd946ccd553 (patch) | |
| tree | b8fd76e0339ce7f6a5468850e1da462249305083 /src | |
| parent | 710e32ad09c15eebc5159fd7caa21054cb772d06 (diff) | |
| parent | 7b5981aad4431f04c8c599d80d9a21d50d680ae1 (diff) | |
| download | rust-e59f65c36e68b01d1aad3faf81e59cd946ccd553.tar.gz rust-e59f65c36e68b01d1aad3faf81e59cd946ccd553.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/session/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index d6f72fb116d..a9200a3c805 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -635,9 +635,13 @@ impl Session { self.perf_stats.incr_comp_hashes_count.get()); println!("Total number of bytes hashed for incr. comp.: {}", self.perf_stats.incr_comp_bytes_hashed.get()); - println!("Average bytes hashed per incr. comp. HIR node: {}", - self.perf_stats.incr_comp_bytes_hashed.get() / - self.perf_stats.incr_comp_hashes_count.get()); + if self.perf_stats.incr_comp_hashes_count.get() != 0 { + println!("Average bytes hashed per incr. comp. HIR node: {}", + self.perf_stats.incr_comp_bytes_hashed.get() / + self.perf_stats.incr_comp_hashes_count.get()); + } else { + println!("Average bytes hashed per incr. comp. HIR node: N/A"); + } println!("Total time spent computing symbol hashes: {}", duration_to_secs_str(self.perf_stats.symbol_hash_time.get())); println!("Total time spent decoding DefPath tables: {}", |
