1
1
//! A framework that can express both [gen-kill] and generic dataflow problems.
2
2
//!
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
5
5
//! operations, prefer `GenKillAnalysis` since it will run faster while iterating to fixpoint. The
6
6
//! `impls` module contains several examples of gen/kill dataflow analyses.
7
7
//!
@@ -96,7 +96,7 @@ impl<T: Idx> BitSetExt<T> for ChunkedBitSet<T> {
96
96
}
97
97
}
98
98
99
- /// Define the domain of a dataflow problem.
99
+ /// Defines the domain of a dataflow problem.
100
100
///
101
101
/// This trait specifies the lattice on which this analysis operates (the domain) as well as its
102
102
/// initial value at the entry point of each basic block.
@@ -113,12 +113,12 @@ pub trait AnalysisDomain<'tcx> {
113
113
/// suitable as part of a filename.
114
114
const NAME : & ' static str ;
115
115
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.
117
117
fn bottom_value ( & self , body : & mir:: Body < ' tcx > ) -> Self :: Domain ;
118
118
119
119
/// Mutates the initial value of the dataflow state upon entry to the `START_BLOCK`.
120
120
///
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
122
122
/// to mutate the initial state will result in a panic.
123
123
//
124
124
// FIXME: For backward dataflow analyses, the initial state should be applied to every basic
@@ -155,9 +155,9 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
155
155
/// Updates the current dataflow state with an effect that occurs immediately *before* the
156
156
/// given statement.
157
157
///
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
159
159
/// *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`.
161
161
fn apply_before_statement_effect (
162
162
& self ,
163
163
_state : & mut Self :: Domain ,
@@ -184,7 +184,7 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
184
184
///
185
185
/// This method is useful if the consumer of the results of this analysis needs only to observe
186
186
/// *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`.
188
188
fn apply_before_terminator_effect (
189
189
& self ,
190
190
_state : & mut Self :: Domain ,
0 commit comments