Skip to content

Commit e1f8a22

Browse files
Rename RequiresStorage to MaybeRequiresStorage
...to be consistent with the naming of other dataflow analyses.
1 parent ecad434 commit e1f8a22

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/librustc_mir/dataflow/impls/storage_liveness.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,24 @@ type BorrowedLocalsResults<'a, 'tcx> = ResultsRefCursor<'a, 'a, 'tcx, MaybeBorro
7171

7272
/// Dataflow analysis that determines whether each local requires storage at a
7373
/// given location; i.e. whether its storage can go away without being observed.
74-
pub struct RequiresStorage<'mir, 'tcx> {
74+
pub struct MaybeRequiresStorage<'mir, 'tcx> {
7575
body: ReadOnlyBodyAndCache<'mir, 'tcx>,
7676
borrowed_locals: RefCell<BorrowedLocalsResults<'mir, 'tcx>>,
7777
}
7878

79-
impl<'mir, 'tcx> RequiresStorage<'mir, 'tcx> {
79+
impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> {
8080
pub fn new(
8181
body: ReadOnlyBodyAndCache<'mir, 'tcx>,
8282
borrowed_locals: &'mir Results<'tcx, MaybeBorrowedLocals>,
8383
) -> Self {
84-
RequiresStorage {
84+
MaybeRequiresStorage {
8585
body,
8686
borrowed_locals: RefCell::new(ResultsRefCursor::new(*body, borrowed_locals)),
8787
}
8888
}
8989
}
9090

91-
impl<'mir, 'tcx> dataflow::AnalysisDomain<'tcx> for RequiresStorage<'mir, 'tcx> {
91+
impl<'mir, 'tcx> dataflow::AnalysisDomain<'tcx> for MaybeRequiresStorage<'mir, 'tcx> {
9292
type Idx = Local;
9393

9494
const NAME: &'static str = "requires_storage";
@@ -106,7 +106,7 @@ impl<'mir, 'tcx> dataflow::AnalysisDomain<'tcx> for RequiresStorage<'mir, 'tcx>
106106
}
107107
}
108108

109-
impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for RequiresStorage<'mir, 'tcx> {
109+
impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'mir, 'tcx> {
110110
fn before_statement_effect(
111111
&self,
112112
trans: &mut impl GenKill<Self::Idx>,
@@ -232,15 +232,15 @@ impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for RequiresStorage<'mir, 'tcx>
232232
}
233233
}
234234

235-
impl<'mir, 'tcx> RequiresStorage<'mir, 'tcx> {
235+
impl<'mir, 'tcx> MaybeRequiresStorage<'mir, 'tcx> {
236236
/// Kill locals that are fully moved and have not been borrowed.
237237
fn check_for_move(&self, trans: &mut impl GenKill<Local>, loc: Location) {
238238
let mut visitor = MoveVisitor { trans, borrowed_locals: &self.borrowed_locals };
239239
visitor.visit_location(self.body, loc);
240240
}
241241
}
242242

243-
impl<'mir, 'tcx> BottomValue for RequiresStorage<'mir, 'tcx> {
243+
impl<'mir, 'tcx> BottomValue for MaybeRequiresStorage<'mir, 'tcx> {
244244
/// bottom = dead
245245
const BOTTOM_VALUE: bool = false;
246246
}

src/librustc_mir/dataflow/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use self::impls::DefinitelyInitializedPlaces;
2525
pub use self::impls::EverInitializedPlaces;
2626
pub use self::impls::{MaybeBorrowedLocals, MaybeMutBorrowedLocals};
2727
pub use self::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
28-
pub use self::impls::{MaybeStorageLive, RequiresStorage};
28+
pub use self::impls::{MaybeRequiresStorage, MaybeStorageLive};
2929

3030
use self::move_paths::MoveData;
3131

src/librustc_mir/transform/generator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
//! Otherwise it drops all the values in scope at the last suspension point.
5151
5252
use crate::dataflow::generic::{self as dataflow, Analysis};
53-
use crate::dataflow::{MaybeBorrowedLocals, MaybeStorageLive, RequiresStorage};
53+
use crate::dataflow::{MaybeBorrowedLocals, MaybeRequiresStorage, MaybeStorageLive};
5454
use crate::transform::no_landing_pads::no_landing_pads;
5555
use crate::transform::simplify;
5656
use crate::transform::{MirPass, MirSource};
@@ -490,7 +490,7 @@ fn locals_live_across_suspend_points(
490490

491491
// Calculate the MIR locals that we actually need to keep storage around
492492
// for.
493-
let requires_storage_results = RequiresStorage::new(body, &borrowed_locals_results)
493+
let requires_storage_results = MaybeRequiresStorage::new(body, &borrowed_locals_results)
494494
.into_engine(tcx, body_ref, def_id)
495495
.iterate_to_fixpoint();
496496
let mut requires_storage_cursor =
@@ -600,7 +600,7 @@ fn compute_storage_conflicts(
600600
body: &'mir Body<'tcx>,
601601
stored_locals: &liveness::LiveVarSet,
602602
ignored: &StorageIgnored,
603-
requires_storage: dataflow::Results<'tcx, RequiresStorage<'mir, 'tcx>>,
603+
requires_storage: dataflow::Results<'tcx, MaybeRequiresStorage<'mir, 'tcx>>,
604604
) -> BitMatrix<GeneratorSavedLocal, GeneratorSavedLocal> {
605605
assert_eq!(body.local_decls.len(), ignored.0.domain_size());
606606
assert_eq!(body.local_decls.len(), stored_locals.domain_size());

0 commit comments

Comments
 (0)