Skip to content

Commit 0520a58

Browse files
ecstatic-morseJoshua Nelson
authored and
Joshua Nelson
committed
Update Visitor and Cursor examples
1 parent 92fdaa6 commit 0520a58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mir/dataflow.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ For example, the following code uses a [`ResultsVisitor`]...
127127

128128
```rust,ignore
129129
// Assuming `MyVisitor` implements `ResultsVisitor<FlowState = MyAnalysis::Domain>`...
130-
let my_visitor = MyVisitor::new();
130+
let mut my_visitor = MyVisitor::new();
131131
132132
// inspect the fixpoint state for every location within every block in RPO.
133-
let results = MyAnalysis()
133+
let results = MyAnalysis::new()
134134
.into_engine(tcx, body, def_id)
135135
.iterate_to_fixpoint()
136-
.visit_with(body, traversal::reverse_postorder(body), &mut my_visitor);
136+
.visit_in_rpo_with(body, &mut my_visitor);
137137
```
138138

139139
whereas this code uses [`ResultsCursor`]:
140140

141141
```rust,ignore
142-
let mut results = MyAnalysis()
142+
let mut results = MyAnalysis::new()
143143
.into_engine(tcx, body, def_id)
144144
.iterate_to_fixpoint()
145145
.into_results_cursor(body);

0 commit comments

Comments
 (0)