Skip to content

Commit 6910d84

Browse files
authored
Rollup merge of rust-lang#98981 - pierwill:pierwill/dataflow-docs-edits, r=Dylan-DPC
Edit `rustc_mir_dataflow::framework` documentation Some edits for clarity and consistency.
2 parents f242e29 + 8c9a130 commit 6910d84

File tree

1 file changed

+8
-8
lines changed
  • compiler/rustc_mir_dataflow/src/framework

1 file changed

+8
-8
lines changed

compiler/rustc_mir_dataflow/src/framework/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A framework that can express both [gen-kill] and generic dataflow problems.
22
//!
3-
//! To actually use this framework, you must implement either the `Analysis` or the
4-
//! `GenKillAnalysis` trait. If your transfer function can be expressed with only gen/kill
3+
//! To use this framework, implement either the [`Analysis`] or the
4+
//! [`GenKillAnalysis`] trait. If your transfer function can be expressed with only gen/kill
55
//! operations, prefer `GenKillAnalysis` since it will run faster while iterating to fixpoint. The
66
//! `impls` module contains several examples of gen/kill dataflow analyses.
77
//!
@@ -96,7 +96,7 @@ impl<T: Idx> BitSetExt<T> for ChunkedBitSet<T> {
9696
}
9797
}
9898

99-
/// Define the domain of a dataflow problem.
99+
/// Defines the domain of a dataflow problem.
100100
///
101101
/// This trait specifies the lattice on which this analysis operates (the domain) as well as its
102102
/// initial value at the entry point of each basic block.
@@ -113,12 +113,12 @@ pub trait AnalysisDomain<'tcx> {
113113
/// suitable as part of a filename.
114114
const NAME: &'static str;
115115

116-
/// The initial value of the dataflow state upon entry to each basic block.
116+
/// Returns the initial value of the dataflow state upon entry to each basic block.
117117
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain;
118118

119119
/// Mutates the initial value of the dataflow state upon entry to the `START_BLOCK`.
120120
///
121-
/// For backward analyses, initial state besides the bottom value is not yet supported. Trying
121+
/// For backward analyses, initial state (besides the bottom value) is not yet supported. Trying
122122
/// to mutate the initial state will result in a panic.
123123
//
124124
// FIXME: For backward dataflow analyses, the initial state should be applied to every basic
@@ -155,9 +155,9 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
155155
/// Updates the current dataflow state with an effect that occurs immediately *before* the
156156
/// given statement.
157157
///
158-
/// This method is useful if the consumer of the results of this analysis needs only to observe
158+
/// This method is useful if the consumer of the results of this analysis only needs to observe
159159
/// *part* of the effect of a statement (e.g. for two-phase borrows). As a general rule,
160-
/// analyses should not implement this without implementing `apply_statement_effect`.
160+
/// analyses should not implement this without also implementing `apply_statement_effect`.
161161
fn apply_before_statement_effect(
162162
&self,
163163
_state: &mut Self::Domain,
@@ -184,7 +184,7 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
184184
///
185185
/// This method is useful if the consumer of the results of this analysis needs only to observe
186186
/// *part* of the effect of a terminator (e.g. for two-phase borrows). As a general rule,
187-
/// analyses should not implement this without implementing `apply_terminator_effect`.
187+
/// analyses should not implement this without also implementing `apply_terminator_effect`.
188188
fn apply_before_terminator_effect(
189189
&self,
190190
_state: &mut Self::Domain,

0 commit comments

Comments
 (0)