about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2024-12-17 18:55:05 +0000
committerRémy Rakic <remy.rakic+github@gmail.com>2024-12-18 07:21:32 +0000
commitdb7d6a9ba8fcc708db07a4880a4c560ee41edcd0 (patch)
tree55681c13aad51691fd0840e747e54ff4763ab3d1
parentef96965f44ac1f0b8d99d39708283e07fadcc945 (diff)
downloadrust-db7d6a9ba8fcc708db07a4880a4c560ee41edcd0.tar.gz
rust-db7d6a9ba8fcc708db07a4880a4c560ee41edcd0.zip
make const qualif use mixed bitsets instead of dense bitsets
-rw-r--r--compiler/rustc_const_eval/src/check_consts/resolver.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/resolver.rs b/compiler/rustc_const_eval/src/check_consts/resolver.rs
index 763c37a41af..79df63a9e84 100644
--- a/compiler/rustc_const_eval/src/check_consts/resolver.rs
+++ b/compiler/rustc_const_eval/src/check_consts/resolver.rs
@@ -5,7 +5,7 @@
 use std::fmt;
 use std::marker::PhantomData;
 
-use rustc_index::bit_set::BitSet;
+use rustc_index::bit_set::MixedBitSet;
 use rustc_middle::mir::visit::Visitor;
 use rustc_middle::mir::{
     self, BasicBlock, CallReturnPlaces, Local, Location, Statement, StatementKind, TerminatorEdges,
@@ -246,12 +246,14 @@ where
 }
 
 #[derive(Debug, PartialEq, Eq)]
+/// The state for the `FlowSensitiveAnalysis` dataflow analysis. This domain is likely homogeneous,
+/// and has a big size, so we use a bitset that can be sparse (c.f. issue #134404).
 pub(super) struct State {
     /// Describes whether a local contains qualif.
-    pub qualif: BitSet<Local>,
+    pub qualif: MixedBitSet<Local>,
     /// Describes whether a local's address escaped and it might become qualified as a result an
     /// indirect mutation.
-    pub borrow: BitSet<Local>,
+    pub borrow: MixedBitSet<Local>,
 }
 
 impl Clone for State {
@@ -320,8 +322,8 @@ where
 
     fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
         State {
-            qualif: BitSet::new_empty(body.local_decls.len()),
-            borrow: BitSet::new_empty(body.local_decls.len()),
+            qualif: MixedBitSet::new_empty(body.local_decls.len()),
+            borrow: MixedBitSet::new_empty(body.local_decls.len()),
         }
     }