about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-07-14 13:50:27 -0400
committerMichael Goulet <michael@errs.io>2024-07-14 14:01:01 -0400
commitdc207339137a766d7f45590a97cfa0f2a0314e2f (patch)
treedbb6b1f0106482c49a7a3e4cda33a5e88985ab0b /compiler/rustc_mir_dataflow
parent88fa119c77682e6d55ce21001cf761675cfebeae (diff)
downloadrust-dc207339137a766d7f45590a97cfa0f2a0314e2f.tar.gz
rust-dc207339137a766d7f45590a97cfa0f2a0314e2f.zip
Stop using the gen keyword in the compiler
Diffstat (limited to 'compiler/rustc_mir_dataflow')
-rw-r--r--compiler/rustc_mir_dataflow/src/framework/mod.rs30
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs8
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/initialized.rs18
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/liveness.rs4
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs12
5 files changed, 36 insertions, 36 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/mod.rs b/compiler/rustc_mir_dataflow/src/framework/mod.rs
index 09cdb055a3e..6eaed0f7753 100644
--- a/compiler/rustc_mir_dataflow/src/framework/mod.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/mod.rs
@@ -402,7 +402,7 @@ where
 /// building up a `GenKillSet` and then throwing it away.
 pub trait GenKill<T> {
     /// Inserts `elem` into the state vector.
-    fn gen(&mut self, elem: T);
+    fn gen_(&mut self, elem: T);
 
     /// Removes `elem` from the state vector.
     fn kill(&mut self, elem: T);
@@ -410,7 +410,7 @@ pub trait GenKill<T> {
     /// Calls `gen` for each element in `elems`.
     fn gen_all(&mut self, elems: impl IntoIterator<Item = T>) {
         for elem in elems {
-            self.gen(elem);
+            self.gen_(elem);
         }
     }
 
@@ -424,12 +424,12 @@ pub trait GenKill<T> {
 
 /// Stores a transfer function for a gen/kill problem.
 ///
-/// Calling `gen`/`kill` on a `GenKillSet` will "build up" a transfer function so that it can be
-/// applied multiple times efficiently. When there are multiple calls to `gen` and/or `kill` for
+/// Calling `gen_`/`kill` on a `GenKillSet` will "build up" a transfer function so that it can be
+/// applied multiple times efficiently. When there are multiple calls to `gen_` and/or `kill` for
 /// the same element, the most recent one takes precedence.
 #[derive(Clone)]
 pub struct GenKillSet<T> {
-    gen: HybridBitSet<T>,
+    gen_: HybridBitSet<T>,
     kill: HybridBitSet<T>,
 }
 
@@ -437,31 +437,31 @@ impl<T: Idx> GenKillSet<T> {
     /// Creates a new transfer function that will leave the dataflow state unchanged.
     pub fn identity(universe: usize) -> Self {
         GenKillSet {
-            gen: HybridBitSet::new_empty(universe),
+            gen_: HybridBitSet::new_empty(universe),
             kill: HybridBitSet::new_empty(universe),
         }
     }
 
     pub fn apply(&self, state: &mut impl BitSetExt<T>) {
-        state.union(&self.gen);
+        state.union(&self.gen_);
         state.subtract(&self.kill);
     }
 }
 
 impl<T: Idx> GenKill<T> for GenKillSet<T> {
-    fn gen(&mut self, elem: T) {
-        self.gen.insert(elem);
+    fn gen_(&mut self, elem: T) {
+        self.gen_.insert(elem);
         self.kill.remove(elem);
     }
 
     fn kill(&mut self, elem: T) {
         self.kill.insert(elem);
-        self.gen.remove(elem);
+        self.gen_.remove(elem);
     }
 }
 
 impl<T: Idx> GenKill<T> for BitSet<T> {
-    fn gen(&mut self, elem: T) {
+    fn gen_(&mut self, elem: T) {
         self.insert(elem);
     }
 
@@ -471,7 +471,7 @@ impl<T: Idx> GenKill<T> for BitSet<T> {
 }
 
 impl<T: Idx> GenKill<T> for ChunkedBitSet<T> {
-    fn gen(&mut self, elem: T) {
+    fn gen_(&mut self, elem: T) {
         self.insert(elem);
     }
 
@@ -481,11 +481,11 @@ impl<T: Idx> GenKill<T> for ChunkedBitSet<T> {
 }
 
 impl<T, S: GenKill<T>> GenKill<T> for MaybeReachable<S> {
-    fn gen(&mut self, elem: T) {
+    fn gen_(&mut self, elem: T) {
         match self {
             // If the state is not reachable, adding an element does nothing.
             MaybeReachable::Unreachable => {}
-            MaybeReachable::Reachable(set) => set.gen(elem),
+            MaybeReachable::Reachable(set) => set.gen_(elem),
         }
     }
 
@@ -499,7 +499,7 @@ impl<T, S: GenKill<T>> GenKill<T> for MaybeReachable<S> {
 }
 
 impl<T: Idx> GenKill<T> for lattice::Dual<BitSet<T>> {
-    fn gen(&mut self, elem: T) {
+    fn gen_(&mut self, elem: T) {
         self.0.insert(elem);
     }
 
diff --git a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
index 574da949b0e..885fdd0d58b 100644
--- a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
@@ -97,7 +97,7 @@ where
             Rvalue::AddressOf(_, borrowed_place)
             | Rvalue::Ref(_, BorrowKind::Mut { .. } | BorrowKind::Shared, borrowed_place) => {
                 if !borrowed_place.is_indirect() {
-                    self.trans.gen(borrowed_place.local);
+                    self.trans.gen_(borrowed_place.local);
                 }
             }
 
@@ -131,7 +131,7 @@ where
                 //
                 // [#61069]: https://github.com/rust-lang/rust/pull/61069
                 if !dropped_place.is_indirect() {
-                    self.trans.gen(dropped_place.local);
+                    self.trans.gen_(dropped_place.local);
                 }
             }
 
@@ -159,8 +159,8 @@ pub fn borrowed_locals(body: &Body<'_>) -> BitSet<Local> {
 
     impl GenKill<Local> for Borrowed {
         #[inline]
-        fn gen(&mut self, elem: Local) {
-            self.0.gen(elem)
+        fn gen_(&mut self, elem: Local) {
+            self.0.gen_(elem)
         }
         #[inline]
         fn kill(&mut self, _: Local) {
diff --git a/compiler/rustc_mir_dataflow/src/impls/initialized.rs b/compiler/rustc_mir_dataflow/src/impls/initialized.rs
index ffcf630b653..a9bceeccdce 100644
--- a/compiler/rustc_mir_dataflow/src/impls/initialized.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/initialized.rs
@@ -283,7 +283,7 @@ impl<'a, 'mir, 'tcx> MaybeInitializedPlaces<'a, 'mir, 'tcx> {
     ) {
         match state {
             DropFlagState::Absent => trans.kill(path),
-            DropFlagState::Present => trans.gen(path),
+            DropFlagState::Present => trans.gen_(path),
         }
     }
 }
@@ -295,7 +295,7 @@ impl<'a, 'tcx> MaybeUninitializedPlaces<'a, '_, 'tcx> {
         state: DropFlagState,
     ) {
         match state {
-            DropFlagState::Absent => trans.gen(path),
+            DropFlagState::Absent => trans.gen_(path),
             DropFlagState::Present => trans.kill(path),
         }
     }
@@ -309,7 +309,7 @@ impl<'a, 'tcx> DefinitelyInitializedPlaces<'a, 'tcx> {
     ) {
         match state {
             DropFlagState::Absent => trans.kill(path),
-            DropFlagState::Present => trans.gen(path),
+            DropFlagState::Present => trans.gen_(path),
         }
     }
 }
@@ -331,7 +331,7 @@ impl<'tcx> AnalysisDomain<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
             MaybeReachable::Reachable(ChunkedBitSet::new_empty(self.move_data().move_paths.len()));
         drop_flag_effects_for_function_entry(self.body, self.mdpe, |path, s| {
             assert!(s == DropFlagState::Present);
-            state.gen(path);
+            state.gen_(path);
         });
     }
 }
@@ -362,7 +362,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
             && let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref())
         {
             on_all_children_bits(self.move_data(), mpi, |child| {
-                trans.gen(child);
+                trans.gen_(child);
             })
         }
     }
@@ -400,7 +400,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, '_, 'tcx> {
                 self.move_data(),
                 self.move_data().rev_lookup.find(place.as_ref()),
                 |mpi| {
-                    trans.gen(mpi);
+                    trans.gen_(mpi);
                 },
             );
         });
@@ -572,7 +572,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> {
                 self.move_data(),
                 enum_place,
                 variant,
-                |mpi| trans.gen(mpi),
+                |mpi| trans.gen_(mpi),
             );
         });
     }
@@ -643,7 +643,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
                 self.move_data(),
                 self.move_data().rev_lookup.find(place.as_ref()),
                 |mpi| {
-                    trans.gen(mpi);
+                    trans.gen_(mpi);
                 },
             );
         });
@@ -738,7 +738,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for EverInitializedPlaces<'_, '_, 'tcx> {
 
         let call_loc = self.body.terminator_loc(block);
         for init_index in &init_loc_map[call_loc] {
-            trans.gen(*init_index);
+            trans.gen_(*init_index);
         }
     }
 }
diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
index 334fa9976f0..48bdb131601 100644
--- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
@@ -116,7 +116,7 @@ where
                     self.0.kill(place.local);
                 }
             }
-            Some(DefUse::Use) => self.0.gen(place.local),
+            Some(DefUse::Use) => self.0.gen_(place.local),
             None => {}
         }
 
@@ -154,7 +154,7 @@ impl DefUse {
     fn apply(trans: &mut impl GenKill<Local>, place: Place<'_>, context: PlaceContext) {
         match DefUse::for_place(place, context) {
             Some(DefUse::Def) => trans.kill(place.local),
-            Some(DefUse::Use) => trans.gen(place.local),
+            Some(DefUse::Use) => trans.gen_(place.local),
             None => {}
         }
     }
diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
index f850a710277..682cec12f1f 100644
--- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
@@ -54,7 +54,7 @@ impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
         _: Location,
     ) {
         match stmt.kind {
-            StatementKind::StorageLive(l) => trans.gen(l),
+            StatementKind::StorageLive(l) => trans.gen_(l),
             StatementKind::StorageDead(l) => trans.kill(l),
             _ => (),
         }
@@ -127,7 +127,7 @@ impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageDead<'a> {
     ) {
         match stmt.kind {
             StatementKind::StorageLive(l) => trans.kill(l),
-            StatementKind::StorageDead(l) => trans.gen(l),
+            StatementKind::StorageDead(l) => trans.gen_(l),
             _ => (),
         }
     }
@@ -208,7 +208,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
             StatementKind::Assign(box (place, _))
             | StatementKind::SetDiscriminant { box place, .. }
             | StatementKind::Deinit(box place) => {
-                trans.gen(place.local);
+                trans.gen_(place.local);
             }
 
             // Nothing to do for these. Match exhaustively so this fails to compile when new
@@ -250,7 +250,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
 
         match &terminator.kind {
             TerminatorKind::Call { destination, .. } => {
-                trans.gen(destination.local);
+                trans.gen_(destination.local);
             }
 
             // Note that we do *not* gen the `resume_arg` of `Yield` terminators. The reason for
@@ -265,7 +265,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
                         InlineAsmOperand::Out { place, .. }
                         | InlineAsmOperand::InOut { out_place: place, .. } => {
                             if let Some(place) = place {
-                                trans.gen(place.local);
+                                trans.gen_(place.local);
                             }
                         }
                         InlineAsmOperand::In { .. }
@@ -341,7 +341,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
         _block: BasicBlock,
         return_places: CallReturnPlaces<'_, 'tcx>,
     ) {
-        return_places.for_each(|place| trans.gen(place.local));
+        return_places.for_each(|place| trans.gen_(place.local));
     }
 }