From e1f8a22271cdca71c7ca310e935ef6446e66c585 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 18 Feb 2020 10:35:16 -0800 Subject: [PATCH] Rename `RequiresStorage` to `MaybeRequiresStorage` ...to be consistent with the naming of other dataflow analyses. --- .../dataflow/impls/storage_liveness.rs | 14 +++++++------- src/librustc_mir/dataflow/mod.rs | 2 +- src/librustc_mir/transform/generator.rs | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index 828321f7031..fabe562e68a 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -71,24 +71,24 @@ impl BottomValue for MaybeStorageLive { /// Dataflow analysis that determines whether each local requires storage at a /// given location; i.e. whether its storage can go away without being observed. -pub struct RequiresStorage<'mir, 'tcx> { +pub struct MaybeRequiresStorage<'mir, 'tcx> { body: ReadOnlyBodyAndCache<'mir, 'tcx>, borrowed_locals: RefCell>, } -impl<'mir, 'tcx> RequiresStorage<'mir, 'tcx> { +impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> { pub fn new( body: ReadOnlyBodyAndCache<'mir, 'tcx>, borrowed_locals: &'mir Results<'tcx, MaybeBorrowedLocals>, ) -> Self { - RequiresStorage { + MaybeRequiresStorage { body, borrowed_locals: RefCell::new(ResultsRefCursor::new(*body, borrowed_locals)), } } } -impl<'mir, 'tcx> dataflow::AnalysisDomain<'tcx> for RequiresStorage<'mir, 'tcx> { +impl<'mir, 'tcx> dataflow::AnalysisDomain<'tcx> for MaybeRequiresStorage<'mir, 'tcx> { type Idx = Local; const NAME: &'static str = "requires_storage"; @@ -106,7 +106,7 @@ fn initialize_start_block(&self, body: &mir::Body<'tcx>, on_entry: &mut BitSet dataflow::GenKillAnalysis<'tcx> for RequiresStorage<'mir, 'tcx> { +impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'mir, 'tcx> { fn before_statement_effect( &self, trans: &mut impl GenKill, @@ -232,7 +232,7 @@ fn call_return_effect( } } -impl<'mir, 'tcx> RequiresStorage<'mir, 'tcx> { +impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> { /// Kill locals that are fully moved and have not been borrowed. fn check_for_move(&self, trans: &mut impl GenKill, loc: Location) { let mut visitor = MoveVisitor { trans, borrowed_locals: &self.borrowed_locals }; @@ -240,7 +240,7 @@ fn check_for_move(&self, trans: &mut impl GenKill, loc: Location) { } } -impl<'mir, 'tcx> BottomValue for RequiresStorage<'mir, 'tcx> { +impl<'mir, 'tcx> BottomValue for MaybeRequiresStorage<'mir, 'tcx> { /// bottom = dead const BOTTOM_VALUE: bool = false; } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index eccdac2fb99..0b45f660c3a 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -25,7 +25,7 @@ pub use self::impls::EverInitializedPlaces; pub use self::impls::{MaybeBorrowedLocals, MaybeMutBorrowedLocals}; pub use self::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; -pub use self::impls::{MaybeStorageLive, RequiresStorage}; +pub use self::impls::{MaybeRequiresStorage, MaybeStorageLive}; use self::move_paths::MoveData; diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index b9d2a167d73..770f93517d0 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -50,7 +50,7 @@ //! Otherwise it drops all the values in scope at the last suspension point. use crate::dataflow::generic::{self as dataflow, Analysis}; -use crate::dataflow::{MaybeBorrowedLocals, MaybeStorageLive, RequiresStorage}; +use crate::dataflow::{MaybeBorrowedLocals, MaybeRequiresStorage, MaybeStorageLive}; use crate::transform::no_landing_pads::no_landing_pads; use crate::transform::simplify; use crate::transform::{MirPass, MirSource}; @@ -490,7 +490,7 @@ fn locals_live_across_suspend_points( // Calculate the MIR locals that we actually need to keep storage around // for. - let requires_storage_results = RequiresStorage::new(body, &borrowed_locals_results) + let requires_storage_results = MaybeRequiresStorage::new(body, &borrowed_locals_results) .into_engine(tcx, body_ref, def_id) .iterate_to_fixpoint(); let mut requires_storage_cursor = @@ -600,7 +600,7 @@ fn compute_storage_conflicts( body: &'mir Body<'tcx>, stored_locals: &liveness::LiveVarSet, ignored: &StorageIgnored, - requires_storage: dataflow::Results<'tcx, RequiresStorage<'mir, 'tcx>>, + requires_storage: dataflow::Results<'tcx, MaybeRequiresStorage<'mir, 'tcx>>, ) -> BitMatrix { assert_eq!(body.local_decls.len(), ignored.0.domain_size()); assert_eq!(body.local_decls.len(), stored_locals.domain_size()); -- 2.44.0