diff options
| author | bors <bors@rust-lang.org> | 2024-11-27 02:13:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-27 02:13:49 +0000 |
| commit | 48696f5bd64f58e1a3d98ccb2a801e079ddef30b (patch) | |
| tree | 28487c9ce9fa4a889da79119d17b4713202c624a /compiler/rustc_mir_dataflow/src | |
| parent | dd2837ec5de4301a692e05a7c4475e980af57a57 (diff) | |
| parent | 702996c31bf142787a30a0adcff8f098177ca1a3 (diff) | |
| download | rust-48696f5bd64f58e1a3d98ccb2a801e079ddef30b.tar.gz rust-48696f5bd64f58e1a3d98ccb2a801e079ddef30b.zip | |
Auto merge of #133516 - compiler-errors:rollup-mq334h8, r=compiler-errors
Rollup of 8 pull requests Successful merges: - #115293 (Remove -Zfuel.) - #132605 (CI: increase timeout from 4h to 6h) - #133304 (Revert diagnostics hack to fix ICE 132920) - #133402 (Constify `Drop` and `Destruct`) - #133458 (Fix `Result` and `Option` not getting a jump to def link generated) - #133471 (gce: fix typing_mode mismatch) - #133475 (`MaybeStorage` improvements) - #133513 (Only ignore windows-gnu in avr-jmp-offset) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/impls/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/lib.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/storage.rs | 20 |
4 files changed, 23 insertions, 28 deletions
diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index 57ded63c9ba..b9e194b00c5 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -14,4 +14,6 @@ pub use self::initialized::{ pub use self::liveness::{ MaybeLiveLocals, MaybeTransitiveLiveLocals, TransferFunction as LivenessTransferFunction, }; -pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageDead, MaybeStorageLive}; +pub use self::storage_liveness::{ + MaybeRequiresStorage, MaybeStorageDead, MaybeStorageLive, always_storage_live_locals, +}; diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs index a6a4f849720..1aae06d79d3 100644 --- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs @@ -7,6 +7,23 @@ use rustc_middle::mir::*; use super::MaybeBorrowedLocals; use crate::{Analysis, GenKill, ResultsCursor}; +/// The set of locals in a MIR body that do not have `StorageLive`/`StorageDead` annotations. +/// +/// These locals have fixed storage for the duration of the body. +pub fn always_storage_live_locals(body: &Body<'_>) -> BitSet<Local> { + let mut always_live_locals = BitSet::new_filled(body.local_decls.len()); + + for block in &*body.basic_blocks { + for statement in &block.statements { + if let StatementKind::StorageLive(l) | StatementKind::StorageDead(l) = statement.kind { + always_live_locals.remove(l); + } + } + } + + always_live_locals +} + pub struct MaybeStorageLive<'a> { always_live_locals: Cow<'a, BitSet<Local>>, } @@ -28,10 +45,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); diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 7ef7c541173..2248972cecc 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -25,7 +25,7 @@ pub use self::framework::{ use self::move_paths::MoveData; pub mod debuginfo; -pub mod drop_flag_effects; +mod drop_flag_effects; pub mod elaborate_drops; mod errors; mod framework; @@ -33,8 +33,7 @@ pub mod impls; pub mod move_paths; pub mod points; pub mod rustc_peek; -pub mod storage; -pub mod un_derefer; +mod un_derefer; pub mod value_analysis; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_mir_dataflow/src/storage.rs b/compiler/rustc_mir_dataflow/src/storage.rs deleted file mode 100644 index e5a0e1d312e..00000000000 --- a/compiler/rustc_mir_dataflow/src/storage.rs +++ /dev/null @@ -1,20 +0,0 @@ -use rustc_index::bit_set::BitSet; -use rustc_middle::mir::{self, Local}; - -/// The set of locals in a MIR body that do not have `StorageLive`/`StorageDead` annotations. -/// -/// These locals have fixed storage for the duration of the body. -pub fn always_storage_live_locals(body: &mir::Body<'_>) -> BitSet<Local> { - let mut always_live_locals = BitSet::new_filled(body.local_decls.len()); - - for block in &*body.basic_blocks { - for statement in &block.statements { - use mir::StatementKind::{StorageDead, StorageLive}; - if let StorageLive(l) | StorageDead(l) = statement.kind { - always_live_locals.remove(l); - } - } - } - - always_live_locals -} |
