about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-28 11:09:28 +0000
committerbors <bors@rust-lang.org>2024-12-28 11:09:28 +0000
commit4e0bc490c60d3588f3ec0aa2eee2cf0696c7c333 (patch)
treedb14ab02283deefcab7c67ad63dddebf1d5b5a2a /compiler/rustc_middle/src
parent8b3f7ac5262531aefa227f90387cf2eb34aae800 (diff)
parente32ec45c02d890e46e55af86163a6d1ba10a4b41 (diff)
downloadrust-4e0bc490c60d3588f3ec0aa2eee2cf0696c7c333.tar.gz
rust-4e0bc490c60d3588f3ec0aa2eee2cf0696c7c333.zip
Auto merge of #131244 - clubby789:match-branches-unreachable, r=DianQK
Consider empty-unreachable otherwise branches in MatchBranchSimplification

Fixes #131219
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/mir/terminator.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs
index b919f5726db..473b817aed0 100644
--- a/compiler/rustc_middle/src/mir/terminator.rs
+++ b/compiler/rustc_middle/src/mir/terminator.rs
@@ -67,6 +67,17 @@ impl SwitchTargets {
         &mut self.targets
     }
 
+    /// Returns a slice with all considered values (not including the fallback).
+    #[inline]
+    pub fn all_values(&self) -> &[Pu128] {
+        &self.values
+    }
+
+    #[inline]
+    pub fn all_values_mut(&mut self) -> &mut [Pu128] {
+        &mut self.values
+    }
+
     /// Finds the `BasicBlock` to which this `SwitchInt` will branch given the
     /// specific value. This cannot fail, as it'll return the `otherwise`
     /// branch if there's not a specific match for the value.