diff options
| author | bors <bors@rust-lang.org> | 2023-10-22 06:42:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-22 06:42:10 +0000 |
| commit | f6be93fc61fb487c496c94ebe76ee999572fc927 (patch) | |
| tree | 21b99801ee214bdc2a57505bdd1dfd64b1b908dc /compiler/rustc_mir_transform/src/coverage/counters.rs | |
| parent | 49e8acbfe953f0c5209916830e02dcc7e005cf68 (diff) | |
| parent | 8cbac823d016c1afb3c24e3d87c2896566a7d5d7 (diff) | |
| download | rust-f6be93fc61fb487c496c94ebe76ee999572fc927.tar.gz rust-f6be93fc61fb487c496c94ebe76ee999572fc927.zip | |
Auto merge of #3133 - rust-lang:rustup-2023-10-22, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/counters.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coverage/counters.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index a83ccf8fc3c..d07f59bc72a 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -169,22 +169,22 @@ impl CoverageCounters { self.bcb_counters[bcb].as_ref() } - pub(super) fn take_bcb_counter(&mut self, bcb: BasicCoverageBlock) -> Option<BcbCounter> { - self.bcb_counters[bcb].take() - } - - pub(super) fn drain_bcb_counters( - &mut self, - ) -> impl Iterator<Item = (BasicCoverageBlock, BcbCounter)> + '_ { + pub(super) fn bcb_node_counters( + &self, + ) -> impl Iterator<Item = (BasicCoverageBlock, &BcbCounter)> { self.bcb_counters - .iter_enumerated_mut() - .filter_map(|(bcb, counter)| Some((bcb, counter.take()?))) + .iter_enumerated() + .filter_map(|(bcb, counter_kind)| Some((bcb, counter_kind.as_ref()?))) } - pub(super) fn drain_bcb_edge_counters( - &mut self, - ) -> impl Iterator<Item = ((BasicCoverageBlock, BasicCoverageBlock), BcbCounter)> + '_ { - self.bcb_edge_counters.drain() + /// For each edge in the BCB graph that has an associated counter, yields + /// that edge's *from* and *to* nodes, and its counter. + pub(super) fn bcb_edge_counters( + &self, + ) -> impl Iterator<Item = (BasicCoverageBlock, BasicCoverageBlock, &BcbCounter)> { + self.bcb_edge_counters + .iter() + .map(|(&(from_bcb, to_bcb), counter_kind)| (from_bcb, to_bcb, counter_kind)) } pub(super) fn take_expressions(&mut self) -> IndexVec<ExpressionId, Expression> { |
