diff options
| author | Sean Cross <sean@xobs.io> | 2021-04-25 00:35:25 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2021-04-25 00:35:25 +0800 |
| commit | f9d390d14ad891c4ce9fe108b86d6756ea5154ee (patch) | |
| tree | 5a12452fef7481362a5fcd06beb491ca4bcf7a69 /compiler/rustc_mir/src/transform/coverage/debug.rs | |
| parent | 8f73fe91f5db7de6e42ad7824a00b9729d2925b2 (diff) | |
| parent | e11a9fa52a3f372dadd6db3d3f2ed7dc2621dcc4 (diff) | |
| download | rust-f9d390d14ad891c4ce9fe108b86d6756ea5154ee.tar.gz rust-f9d390d14ad891c4ce9fe108b86d6756ea5154ee.zip | |
Merge remote-tracking branch 'upstream/master' into impl-16351-nightly
Signed-off-by: Sean Cross <sean@xobs.io>
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/debug.rs')
| -rw-r--r-- | compiler/rustc_mir/src/transform/coverage/debug.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_mir/src/transform/coverage/debug.rs b/compiler/rustc_mir/src/transform/coverage/debug.rs index 2cd0dc6b1f2..48361483099 100644 --- a/compiler/rustc_mir/src/transform/coverage/debug.rs +++ b/compiler/rustc_mir/src/transform/coverage/debug.rs @@ -121,6 +121,7 @@ use rustc_middle::mir::coverage::*; use rustc_middle::mir::{self, BasicBlock, TerminatorKind}; use rustc_middle::ty::TyCtxt; +use std::iter; use std::lazy::SyncOnceCell; pub const NESTED_INDENT: &str = " "; @@ -285,10 +286,8 @@ impl DebugCounters { ), }; counters - .insert(id, DebugCounter::new(counter_kind.clone(), some_block_label)) - .expect_none( - "attempt to add the same counter_kind to DebugCounters more than once", - ); + .try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label)) + .expect("attempt to add the same counter_kind to DebugCounters more than once"); } } @@ -479,9 +478,9 @@ impl GraphvizData { counter_kind: &CoverageKind, ) { if let Some(edge_to_counter) = self.some_edge_to_counter.as_mut() { - edge_to_counter.insert((from_bcb, to_bb), counter_kind.clone()).expect_none( - "invalid attempt to insert more than one edge counter for the same edge", - ); + edge_to_counter + .try_insert((from_bcb, to_bb), counter_kind.clone()) + .expect("invalid attempt to insert more than one edge counter for the same edge"); } } @@ -705,9 +704,7 @@ pub(super) fn dump_coverage_graphviz( let edge_counters = from_terminator .successors() .map(|&successor_bb| graphviz_data.get_edge_counter(from_bcb, successor_bb)); - edge_labels - .iter() - .zip(edge_counters) + iter::zip(&edge_labels, edge_counters) .map(|(label, some_counter)| { if let Some(counter) = some_counter { format!("{}\n{}", label, debug_counters.format_counter(counter)) @@ -819,7 +816,7 @@ fn bcb_to_string_sections( sections } -/// Returns a simple string representation of a `TerminatorKind` variant, indenpendent of any +/// Returns a simple string representation of a `TerminatorKind` variant, independent of any /// values it might hold. pub(super) fn term_type(kind: &TerminatorKind<'tcx>) -> &'static str { match kind { |
