diff options
| author | bors <bors@rust-lang.org> | 2023-10-21 09:09:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-10-21 09:09:05 +0000 |
| commit | 6f97d838c644174b38413d920ed8d43b70cdc7db (patch) | |
| tree | 443e691d3ebb017ad2c75a8b38ccea91d0c98152 /compiler/rustc_mir_transform/src/coverage/counters.rs | |
| parent | 45a45c6e60835e15c92374be1f832bc756fc8b1a (diff) | |
| parent | e9d18f5f78dba3fbaf5763000715533994627eb1 (diff) | |
| download | rust-6f97d838c644174b38413d920ed8d43b70cdc7db.tar.gz rust-6f97d838c644174b38413d920ed8d43b70cdc7db.zip | |
Auto merge of #117013 - matthiaskrgr:rollup-mvgp54x, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #114521 (std: freebsd build update.) - #116911 (Suggest relaxing implicit `type Assoc: Sized;` bound) - #116917 (coverage: Simplify the injection of coverage statements) - #116961 (Typo suggestion to change bindings with leading underscore) - #116964 (Add stable Instance::body() and RustcInternal trait) - #116974 (coverage: Fix inconsistent handling of function signature spans) - #116990 (Mention `into_iter` on borrow errors suggestions when appropriate) - #116995 (Point at assoc fn definition on type param divergence) r? `@ghost` `@rustbot` modify labels: rollup
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> { |
