13
13
//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
14
14
//! deeper traversal by doing nothing.
15
15
//!
16
- //! Note: it is an important invariant that the default visitor walks the body
17
- //! of a function in "execution order" (more concretely, reverse post-order
18
- //! with respect to the CFG implied by the AST), meaning that if AST node A may
19
- //! execute before AST node B, then A is visited first. The borrow checker in
20
- //! particular relies on this property.
16
+ //! When visiting the HIR, the contents of nested items are NOT visited
17
+ //! by default. This is different from the AST visitor, which does a deep walk.
18
+ //! Hence this module is called `intravisit`; see the method `visit_nested_item`
19
+ //! for more details.
21
20
//!
22
- //! Note: walking an AST before macro expansion is probably a bad idea. For
23
- //! instance, a walker looking for item names in a module will miss all of
24
- //! those that are created by the expansion of a macro.
21
+ //! Note: it is an important invariant that the default visitor walks
22
+ //! the body of a function in "execution order" (more concretely,
23
+ //! reverse post-order with respect to the CFG implied by the AST),
24
+ //! meaning that if AST node A may execute before AST node B, then A
25
+ //! is visited first. The borrow checker in particular relies on this
26
+ //! property.
25
27
26
28
use syntax:: abi:: Abi ;
27
29
use syntax:: ast:: { Ident , NodeId , CRATE_NODE_ID , Name , Attribute } ;
@@ -45,8 +47,10 @@ pub enum FnKind<'a> {
45
47
/// the substructure of the input via the corresponding `walk` method;
46
48
/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
47
49
///
48
- /// Note that this visitor does NOT visit nested items by default. If
49
- /// you simply want to visit all items in the crate in some order, you
50
+ /// Note that this visitor does NOT visit nested items by default
51
+ /// (this is why the module is called `intravisit`, to distinguish it
52
+ /// from the AST's `visit` module, which acts differently). If you
53
+ /// simply want to visit all items in the crate in some order, you
50
54
/// should call `Crate::visit_all_items`. Otherwise, see the comment
51
55
/// on `visit_nested_item` for details on how to visit nested items.
52
56
///
0 commit comments