Skip to content

Commit

Permalink
Rollup merge of #98981 - pierwill:pierwill/dataflow-docs-edits, r=Dyl…
Browse files Browse the repository at this point in the history
…an-DPC

 Edit `rustc_mir_dataflow::framework` documentation

Some edits for clarity and consistency.
  • Loading branch information
Dylan-DPC authored Jul 7, 2022
2 parents f242e29 + 8c9a130 commit 6910d84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A framework that can express both [gen-kill] and generic dataflow problems.
//!
//! To actually use this framework, you must implement either the `Analysis` or the
//! `GenKillAnalysis` trait. If your transfer function can be expressed with only gen/kill
//! To use this framework, implement either the [`Analysis`] or the
//! [`GenKillAnalysis`] trait. If your transfer function can be expressed with only gen/kill
//! operations, prefer `GenKillAnalysis` since it will run faster while iterating to fixpoint. The
//! `impls` module contains several examples of gen/kill dataflow analyses.
//!
Expand Down Expand Up @@ -96,7 +96,7 @@ impl<T: Idx> BitSetExt<T> for ChunkedBitSet<T> {
}
}

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

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

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

0 comments on commit 6910d84

Please sign in to comment.