about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-27 17:54:24 +0000
committerbors <bors@rust-lang.org>2023-06-27 17:54:24 +0000
commit5ea66686467d3ec5f8c81570e7f0f16ad8dd8cc3 (patch)
treed274cb5b7df7d9f2ac3427400a74daa26ffe9c5a /compiler/rustc_mir_transform/src/coverage/debug.rs
parent3c554f5cb4965a08f2a2b45ab4bba321a5f249fa (diff)
parentadc3ae24d6a53466a594bf181c6fc135bd24d1c8 (diff)
downloadrust-5ea66686467d3ec5f8c81570e7f0f16ad8dd8cc3.tar.gz
rust-5ea66686467d3ec5f8c81570e7f0f16ad8dd8cc3.zip
Auto merge of #113102 - matthiaskrgr:rollup-wpkbsw1, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112518 (Detect actual span for getting unexpected token from parsing macros)
 - #112978 (Add suggestion for bad block fragment error)
 - #113068 (bootstrap: rename 'user' profile to 'dist')
 - #113079 (Use `CoverageKind::as_operand_id` instead of manually reimplementing it)
 - #113089 (Export AnalysisResults trait in rustc_mir_dataflow)
 - #113093 (`thir`: Add `Become` expression kind)
 - #113096 (Remove unused struct and tweak format macro uses)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
-rw-r--r--compiler/rustc_mir_transform/src/coverage/debug.rs17
1 files changed, 2 insertions, 15 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/debug.rs b/compiler/rustc_mir_transform/src/coverage/debug.rs
index 6a3d42511ac..7ad98144159 100644
--- a/compiler/rustc_mir_transform/src/coverage/debug.rs
+++ b/compiler/rustc_mir_transform/src/coverage/debug.rs
@@ -277,14 +277,7 @@ impl DebugCounters {
 
     pub fn add_counter(&mut self, counter_kind: &CoverageKind, some_block_label: Option<String>) {
         if let Some(counters) = &mut self.some_counters {
-            let id: ExpressionOperandId = match *counter_kind {
-                CoverageKind::Counter { id, .. } => id.into(),
-                CoverageKind::Expression { id, .. } => id.into(),
-                _ => bug!(
-                    "the given `CoverageKind` is not an counter or expression: {:?}",
-                    counter_kind
-                ),
-            };
+            let id = counter_kind.as_operand_id();
             counters
                 .try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
                 .expect("attempt to add the same counter_kind to DebugCounters more than once");
@@ -330,13 +323,7 @@ impl DebugCounters {
             }
         }
 
-        let id: ExpressionOperandId = match *counter_kind {
-            CoverageKind::Counter { id, .. } => id.into(),
-            CoverageKind::Expression { id, .. } => id.into(),
-            _ => {
-                bug!("the given `CoverageKind` is not an counter or expression: {:?}", counter_kind)
-            }
-        };
+        let id = counter_kind.as_operand_id();
         if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
             let counters = self.some_counters.as_ref().unwrap();
             if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =