ast_validation -> new crate rustc_ast_passes
This commit is contained in:
parent
f361b71a7d
commit
ed69fbbc44
7 changed files with 44 additions and 5 deletions
14
Cargo.lock
14
Cargo.lock
|
@ -3374,6 +3374,19 @@ dependencies = [
|
|||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_ast_passes"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc_data_structures",
|
||||
"rustc_error_codes",
|
||||
"rustc_errors",
|
||||
"rustc_parse",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_builtin_macros"
|
||||
version = "0.0.0"
|
||||
|
@ -3615,6 +3628,7 @@ dependencies = [
|
|||
"rustc",
|
||||
"rustc-rayon",
|
||||
"rustc_ast_lowering",
|
||||
"rustc_ast_passes",
|
||||
"rustc_builtin_macros",
|
||||
"rustc_codegen_llvm",
|
||||
"rustc_codegen_ssa",
|
||||
|
|
18
src/librustc_ast_passes/Cargo.toml
Normal file
18
src/librustc_ast_passes/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_ast_passes"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_ast_passes"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
rustc_error_codes = { path = "../librustc_error_codes" }
|
||||
rustc_parse = { path = "../librustc_parse" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
syntax = { path = "../libsyntax" }
|
|
@ -6,10 +6,10 @@
|
|||
// This pass is supposed to perform only simple checks not requiring name resolution
|
||||
// or type checking or some other kind of complex analysis.
|
||||
|
||||
use rustc::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{struct_span_err, Applicability, FatalError};
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_session::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
|
||||
use rustc_session::lint::LintBuffer;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::Spanned;
|
||||
|
@ -907,7 +907,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
Some(Constness::Const) => bug!("Parser should reject bare `const` on bounds"),
|
||||
Some(Constness::Const) => panic!("Parser should reject bare `const` on bounds"),
|
||||
None => {}
|
||||
}
|
||||
}
|
7
src/librustc_ast_passes/lib.rs
Normal file
7
src/librustc_ast_passes/lib.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
//! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
|
||||
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
|
||||
//! by `rustc_ast_lowering`.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
pub mod ast_validation;
|
|
@ -22,6 +22,7 @@ rustc_span = { path = "../librustc_span" }
|
|||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_ast_lowering = { path = "../librustc_ast_lowering" }
|
||||
rustc_ast_passes = { path = "../librustc_ast_passes" }
|
||||
rustc_incremental = { path = "../librustc_incremental" }
|
||||
rustc_traits = { path = "../librustc_traits" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
|
|
|
@ -29,7 +29,7 @@ use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
|||
use rustc_incremental;
|
||||
use rustc_mir as mir;
|
||||
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
|
||||
use rustc_passes::{self, ast_validation, hir_stats, layout_test};
|
||||
use rustc_passes::{self, hir_stats, layout_test};
|
||||
use rustc_plugin_impl as plugin;
|
||||
use rustc_privacy;
|
||||
use rustc_resolve::{Resolver, ResolverArenas};
|
||||
|
@ -344,7 +344,7 @@ fn configure_and_expand_inner<'a>(
|
|||
}
|
||||
|
||||
let has_proc_macro_decls = sess.time("AST_validation", || {
|
||||
ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
|
||||
rustc_ast_passes::ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer())
|
||||
});
|
||||
|
||||
let crate_types = sess.crate_types.borrow();
|
||||
|
|
|
@ -17,7 +17,6 @@ extern crate log;
|
|||
|
||||
use rustc::ty::query::Providers;
|
||||
|
||||
pub mod ast_validation;
|
||||
mod check_const;
|
||||
pub mod dead;
|
||||
mod diagnostic_items;
|
||||
|
|
Loading…
Add table
Reference in a new issue