Skip to content

Commit 9b4823d

Browse files
committed
{syntax -> rustc_ast_passes}::node_count
1 parent 35b5157 commit 9b4823d

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/librustc_ast_passes/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
//! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
22
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
33
//! by `rustc_ast_lowering`.
4+
//!
5+
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
46
57
#![feature(slice_patterns)]
68

79
pub mod ast_validation;
810
pub mod feature_gate;
11+
pub mod node_count;
912
pub mod show_span;

src/libsyntax/util/node_count.rs renamed to src/librustc_ast_passes/node_count.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Simply gives a rought count of the number of nodes in an AST.
22

3-
use crate::ast::*;
4-
use crate::visit::*;
53
use rustc_span::Span;
4+
use syntax::ast::*;
5+
use syntax::visit::*;
66

77
pub struct NodeCounter {
88
pub count: usize,

src/librustc_interface/passes.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use rustc_span::FileName;
4040
use rustc_traits;
4141
use rustc_typeck as typeck;
4242
use syntax::mut_visit::MutVisitor;
43-
use syntax::util::node_count::NodeCounter;
4443
use syntax::{self, ast, visit};
4544

4645
use rustc_serialize::json;
@@ -83,7 +82,7 @@ pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> {
8382
}
8483

8584
fn count_nodes(krate: &ast::Crate) -> usize {
86-
let mut counter = NodeCounter::new();
85+
let mut counter = rustc_ast_passes::node_count::NodeCounter::new();
8786
visit::walk_crate(&mut counter, krate);
8887
counter.count
8988
}

src/libsyntax/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ pub mod util {
6767
pub mod lev_distance;
6868
pub mod literal;
6969
pub mod map_in_place;
70-
pub mod node_count;
7170
pub mod parser;
7271
}
7372

0 commit comments

Comments
 (0)