about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/framework/lattice.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2024-06-26 21:57:59 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2024-07-01 15:41:21 +0000
commit76244d4dbc768e15e429c1f66ec021884f369f5f (patch)
tree247d7d63cb92520e7c1316a19e929e0a336200bd /compiler/rustc_mir_dataflow/src/framework/lattice.rs
parent1834f5a272d567a714f78c7f48c0d3ae4a6238bb (diff)
downloadrust-76244d4dbc768e15e429c1f66ec021884f369f5f.tar.gz
rust-76244d4dbc768e15e429c1f66ec021884f369f5f.zip
Make jump threading state sparse.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/framework/lattice.rs')
-rw-r--r--compiler/rustc_mir_dataflow/src/framework/lattice.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/lattice.rs b/compiler/rustc_mir_dataflow/src/framework/lattice.rs
index 1c2b475a43c..23738f7a4a5 100644
--- a/compiler/rustc_mir_dataflow/src/framework/lattice.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/lattice.rs
@@ -76,6 +76,8 @@ pub trait MeetSemiLattice: Eq {
 /// A set that has a "bottom" element, which is less than or equal to any other element.
 pub trait HasBottom {
     const BOTTOM: Self;
+
+    fn is_bottom(&self) -> bool;
 }
 
 /// A set that has a "top" element, which is greater than or equal to any other element.
@@ -114,6 +116,10 @@ impl MeetSemiLattice for bool {
 
 impl HasBottom for bool {
     const BOTTOM: Self = false;
+
+    fn is_bottom(&self) -> bool {
+        !self
+    }
 }
 
 impl HasTop for bool {
@@ -267,6 +273,10 @@ impl<T: Clone + Eq> MeetSemiLattice for FlatSet<T> {
 
 impl<T> HasBottom for FlatSet<T> {
     const BOTTOM: Self = Self::Bottom;
+
+    fn is_bottom(&self) -> bool {
+        matches!(self, Self::Bottom)
+    }
 }
 
 impl<T> HasTop for FlatSet<T> {
@@ -291,6 +301,10 @@ impl<T> MaybeReachable<T> {
 
 impl<T> HasBottom for MaybeReachable<T> {
     const BOTTOM: Self = MaybeReachable::Unreachable;
+
+    fn is_bottom(&self) -> bool {
+        matches!(self, Self::Unreachable)
+    }
 }
 
 impl<T: HasTop> HasTop for MaybeReachable<T> {