Skip to content

Commit ed69fbb

Browse files
committed
ast_validation -> new crate rustc_ast_passes
1 parent f361b71 commit ed69fbb

File tree

7 files changed

+44
-5
lines changed

7 files changed

+44
-5
lines changed

Cargo.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,6 +3374,19 @@ dependencies = [
33743374
"syntax",
33753375
]
33763376

3377+
[[package]]
3378+
name = "rustc_ast_passes"
3379+
version = "0.0.0"
3380+
dependencies = [
3381+
"rustc_data_structures",
3382+
"rustc_error_codes",
3383+
"rustc_errors",
3384+
"rustc_parse",
3385+
"rustc_session",
3386+
"rustc_span",
3387+
"syntax",
3388+
]
3389+
33773390
[[package]]
33783391
name = "rustc_builtin_macros"
33793392
version = "0.0.0"
@@ -3615,6 +3628,7 @@ dependencies = [
36153628
"rustc",
36163629
"rustc-rayon",
36173630
"rustc_ast_lowering",
3631+
"rustc_ast_passes",
36183632
"rustc_builtin_macros",
36193633
"rustc_codegen_llvm",
36203634
"rustc_codegen_ssa",

src/librustc_ast_passes/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
authors = ["The Rust Project Developers"]
3+
name = "rustc_ast_passes"
4+
version = "0.0.0"
5+
edition = "2018"
6+
7+
[lib]
8+
name = "rustc_ast_passes"
9+
path = "lib.rs"
10+
11+
[dependencies]
12+
rustc_data_structures = { path = "../librustc_data_structures" }
13+
rustc_errors = { path = "../librustc_errors", package = "rustc_errors" }
14+
rustc_error_codes = { path = "../librustc_error_codes" }
15+
rustc_parse = { path = "../librustc_parse" }
16+
rustc_session = { path = "../librustc_session" }
17+
rustc_span = { path = "../librustc_span" }
18+
syntax = { path = "../libsyntax" }

src/librustc_passes/ast_validation.rs renamed to src/librustc_ast_passes/ast_validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// This pass is supposed to perform only simple checks not requiring name resolution
77
// or type checking or some other kind of complex analysis.
88

9-
use rustc::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
109
use rustc_data_structures::fx::FxHashMap;
1110
use rustc_errors::{struct_span_err, Applicability, FatalError};
1211
use rustc_parse::validate_attr;
12+
use rustc_session::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
1313
use rustc_session::lint::LintBuffer;
1414
use rustc_session::Session;
1515
use rustc_span::source_map::Spanned;
@@ -907,7 +907,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
907907
}
908908
}
909909

910-
Some(Constness::Const) => bug!("Parser should reject bare `const` on bounds"),
910+
Some(Constness::Const) => panic!("Parser should reject bare `const` on bounds"),
911911
None => {}
912912
}
913913
}

src/librustc_ast_passes/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
2+
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
3+
//! by `rustc_ast_lowering`.
4+
5+
#![feature(slice_patterns)]
6+
7+
pub mod ast_validation;

src/librustc_interface/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ rustc_span = { path = "../librustc_span" }
2222
rustc_serialize = { path = "../libserialize", package = "serialize" }
2323
rustc = { path = "../librustc" }
2424
rustc_ast_lowering = { path = "../librustc_ast_lowering" }
25+
rustc_ast_passes = { path = "../librustc_ast_passes" }
2526
rustc_incremental = { path = "../librustc_incremental" }
2627
rustc_traits = { path = "../librustc_traits" }
2728
rustc_data_structures = { path = "../librustc_data_structures" }

src/librustc_interface/passes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
2929
use rustc_incremental;
3030
use rustc_mir as mir;
3131
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
32-
use rustc_passes::{self, ast_validation, hir_stats, layout_test};
32+
use rustc_passes::{self, hir_stats, layout_test};
3333
use rustc_plugin_impl as plugin;
3434
use rustc_privacy;
3535
use rustc_resolve::{Resolver, ResolverArenas};
@@ -344,7 +344,7 @@ fn configure_and_expand_inner<'a>(
344344
}
345345

346346
let has_proc_macro_decls = sess.time("AST_validation", || {
347-
ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
347+
rustc_ast_passes::ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
348348
});
349349

350350
let crate_types = sess.crate_types.borrow();

src/librustc_passes/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern crate log;
1717

1818
use rustc::ty::query::Providers;
1919

20-
pub mod ast_validation;
2120
mod check_const;
2221
pub mod dead;
2322
mod diagnostic_items;

0 commit comments

Comments
 (0)