diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-09-13 12:30:29 -0700 |
|---|---|---|
| committer | Joshua Nelson <joshua@yottadb.com> | 2020-09-13 15:58:02 -0400 |
| commit | 153e35ff276436b16e49c0e47d78d03679d5da47 (patch) | |
| tree | e4a8c5ca029efcb81bc1c72c236feb3084fa7357 /src/doc/rustc-dev-guide | |
| parent | c6e556591e6406b3fadb5db4feb2be09b4bb48b7 (diff) | |
| download | rust-153e35ff276436b16e49c0e47d78d03679d5da47.tar.gz rust-153e35ff276436b16e49c0e47d78d03679d5da47.zip | |
Update `Visitor` and `Cursor` examples
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/mir/dataflow.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/src/mir/dataflow.md b/src/doc/rustc-dev-guide/src/mir/dataflow.md index 9f93921b4b0..5b10afec1f3 100644 --- a/src/doc/rustc-dev-guide/src/mir/dataflow.md +++ b/src/doc/rustc-dev-guide/src/mir/dataflow.md @@ -127,19 +127,19 @@ For example, the following code uses a [`ResultsVisitor`]... ```rust,ignore // Assuming `MyVisitor` implements `ResultsVisitor<FlowState = MyAnalysis::Domain>`... -let my_visitor = MyVisitor::new(); +let mut my_visitor = MyVisitor::new(); // inspect the fixpoint state for every location within every block in RPO. -let results = MyAnalysis() +let results = MyAnalysis::new() .into_engine(tcx, body, def_id) .iterate_to_fixpoint() - .visit_with(body, traversal::reverse_postorder(body), &mut my_visitor); + .visit_in_rpo_with(body, &mut my_visitor); ``` whereas this code uses [`ResultsCursor`]: ```rust,ignore -let mut results = MyAnalysis() +let mut results = MyAnalysis::new() .into_engine(tcx, body, def_id) .iterate_to_fixpoint() .into_results_cursor(body); |
