about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-11-22 16:30:35 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-11-26 12:05:44 +1100
commit71789427a3b420fc4e729a748e1bf22d0a444bfa (patch)
treead70c7ea21cbaf0d0f95004190425fe6b1f192fb /compiler/rustc_mir_dataflow/src
parent481b5fadd7994d0f04e9a6fe9ded3f22d6753825 (diff)
downloadrust-71789427a3b420fc4e729a748e1bf22d0a444bfa.tar.gz
rust-71789427a3b420fc4e729a748e1bf22d0a444bfa.zip
Improve `MaybeStorageLive::initialize_start_block`.
We can union the two sets the easy way. This removes the need for the
domain size check, because `union` does that same check itself.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
index 576289e228a..1315d7aab4d 100644
--- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
@@ -28,10 +28,7 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeStorageLive<'a> {
     }
 
     fn initialize_start_block(&self, body: &Body<'tcx>, on_entry: &mut Self::Domain) {
-        assert_eq!(body.local_decls.len(), self.always_live_locals.domain_size());
-        for local in self.always_live_locals.iter() {
-            on_entry.insert(local);
-        }
+        on_entry.union(&*self.always_live_locals);
 
         for arg in body.args_iter() {
             on_entry.insert(arg);