Skip to content

Commit ed695f4

Browse files
committed
Separate Analysis and Results.
`Results` contains and `Analysis` and an `EntryStates`. The unfortunate thing about this is that the analysis needs to be mutable everywhere (`&mut Analysis`) which forces the `Results` to be mutable everywhere, even though `EntryStates` is immutable everywhere. To fix this, this commit renames `Results` as `AnalysisAndResults`, renames `EntryStates` as `Results`, and separates the analysis and results as much as possible. (`AnalysisAndResults` doesn't get much use, it's mostly there to facilitate method chaining of `iterate_to_fixpoint`.) `Results` is immutable everywhere, which: - is a bit clearer on how the data is used, - avoids an unnecessary clone of entry states in `locals_live_across_suspend_points`, and - moves the results outside the `RefCell` in Formatter. The commit also reformulates `ResultsHandle` as the generic `CowMut`, which is simpler than `ResultsHandle` because it doesn't need the `'tcx` lifetime and the trait bounds. It also which sits nicely alongside the new use of `Cow` in `ResultsCursor`.
1 parent 7537d3b commit ed695f4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/mir/dataflow.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ whereas this code uses [`ResultsCursor`]:
148148

149149
```rust,ignore
150150
let mut results = MyAnalysis::new()
151-
.into_engine(tcx, body, def_id)
152-
.iterate_to_fixpoint()
151+
.iterate_to_fixpoint(tcx, body, None);
153152
.into_results_cursor(body);
154153
155154
// Inspect the fixpoint state immediately before each `Drop` terminator.

0 commit comments

Comments
 (0)