Skip to content

Commit 3b52cca

Browse files
committed
Correct incorrect description of preorder traversals.
1 parent 27f5d83 commit 3b52cca

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

compiler/rustc_middle/src/mir/traversal.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ use super::*;
44

55
/// Preorder traversal of a graph.
66
///
7-
/// Preorder traversal is when each node is visited before any of its
8-
/// successors
7+
/// Preorder traversal is when each node is visited after at least one of its predecessors. If you
8+
/// are familar with some basic graph theory, then this performs a depth first search and returns
9+
/// nodes in order of discovery time.
910
///
1011
/// ```text
1112
///
@@ -82,8 +83,9 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> {
8283

8384
/// Postorder traversal of a graph.
8485
///
85-
/// Postorder traversal is when each node is visited after all of its
86-
/// successors, except when the successor is only reachable by a back-edge
86+
/// Postorder traversal is when each node is visited after all of its successors, except when the
87+
/// successor is only reachable by a back-edge. If you are familiar with some basic graph theory,
88+
/// then this performs a depth first search and returns nodes in order of completion time.
8789
///
8890
///
8991
/// ```text

0 commit comments

Comments
 (0)