Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store items out-of-line in the HIR #29903

Merged
merged 19 commits into from
Nov 19, 2015
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6913ed0
Remove seemingly pointless case -- this customized variant avoided
nikomatsakis Oct 31, 2015
6ccd390
rename `_lctx` to `lctx` where appropriate
nikomatsakis Nov 12, 2015
66326bc
refactorings of `lowering` that make it more amenable to using `&mut`
nikomatsakis Nov 12, 2015
767ee79
Refactor the HIR so that items are stored in a map in the `Crate`,
nikomatsakis Nov 17, 2015
25727d7
Port the `map` construction code to use the new visitor.
nikomatsakis Nov 17, 2015
e14562d
Rework the `IdVisitor` so that it only visits item contents (and doesn't
nikomatsakis Nov 17, 2015
e4ff9f7
Port a bunch of code new-visitor; all of these ports were
nikomatsakis Nov 17, 2015
ac38021
Port entry code to `visit_all_items` -- since this was tracking whether
nikomatsakis Nov 17, 2015
98b046e
Various straight-forward ports that override `visit_nested_items`
nikomatsakis Nov 17, 2015
1e941f8
Port trans to use visit_all_items: this was mostly straight-forward, but
nikomatsakis Nov 17, 2015
db97c93
Add comment explaining why it is called `intravisit`
nikomatsakis Nov 18, 2015
e303c25
Change to a BTreeMap rather than sorting the keys of a FnvHashMap.
nikomatsakis Nov 18, 2015
0bc6140
Remove rustc_data_structures from the deps of librustc_front now
nikomatsakis Nov 18, 2015
06f2d9d
Modify trans to use an outer walk and ensure that we rotate as we
nikomatsakis Nov 18, 2015
bca026e
Fix two long lines.
nikomatsakis Nov 18, 2015
7c2ee5e
Patch graphviz tests to account for the fact that nested items are not
nikomatsakis Nov 18, 2015
cfe4c35
ratchet down the recursion limit because, at least in my testing,
nikomatsakis Nov 18, 2015
f8f2e2b
minor fixes to #[cfg(test)] code
nikomatsakis Nov 18, 2015
7926fa1
Update unit tests in driver.
nikomatsakis Nov 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/librustc_front/intravisit.rs
Original file line number Diff line number Diff line change
@@ -13,15 +13,17 @@
//! call `visit::walk_*` to apply the default traversal algorithm, or prevent
//! deeper traversal by doing nothing.
//!
//! Note: it is an important invariant that the default visitor walks the body
//! of a function in "execution order" (more concretely, reverse post-order
//! with respect to the CFG implied by the AST), meaning that if AST node A may
//! execute before AST node B, then A is visited first. The borrow checker in
//! particular relies on this property.
//! When visiting the HIR, the contents of nested items are NOT visited
//! by default. This is different from the AST visitor, which does a deep walk.
//! Hence this module is called `intravisit`; see the method `visit_nested_item`
//! for more details.
//!
//! Note: walking an AST before macro expansion is probably a bad idea. For
//! instance, a walker looking for item names in a module will miss all of
//! those that are created by the expansion of a macro.
//! Note: it is an important invariant that the default visitor walks
//! the body of a function in "execution order" (more concretely,
//! reverse post-order with respect to the CFG implied by the AST),
//! meaning that if AST node A may execute before AST node B, then A
//! is visited first. The borrow checker in particular relies on this
//! property.
use syntax::abi::Abi;
use syntax::ast::{Ident, NodeId, CRATE_NODE_ID, Name, Attribute};
@@ -45,8 +47,10 @@ pub enum FnKind<'a> {
/// the substructure of the input via the corresponding `walk` method;
/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
///
/// Note that this visitor does NOT visit nested items by default. If
/// you simply want to visit all items in the crate in some order, you
/// Note that this visitor does NOT visit nested items by default
/// (this is why the module is called `intravisit`, to distinguish it
/// from the AST's `visit` module, which acts differently). If you
/// simply want to visit all items in the crate in some order, you
/// should call `Crate::visit_all_items`. Otherwise, see the comment
/// on `visit_nested_item` for details on how to visit nested items.
///