diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-09-28 00:28:49 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-01-23 18:51:51 +0800 |
| commit | 452aa81770d0f2aa05e874122cc15cc73e51235c (patch) | |
| tree | 95335e50b9d8e478575f39de5d218a1f5b6019d5 /compiler/rustc_interface/src | |
| parent | d13e8dd41d44a73664943169d5b7fe39b22c449f (diff) | |
| download | rust-452aa81770d0f2aa05e874122cc15cc73e51235c.tar.gz rust-452aa81770d0f2aa05e874122cc15cc73e51235c.zip | |
rustc_lint: Remove some redundant fields from `EarlyContext`
Use consistent function parameter order for early context construction and early linting Rename some functions to make it clear that they do not necessarily work on the whole crate
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 33bf670f570..93d1976eb1e 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -236,19 +236,19 @@ pub fn register_plugins<'a>( fn pre_expansion_lint( sess: &Session, lint_store: &LintStore, - krate: &ast::Crate, crate_attrs: &[ast::Attribute], - crate_name: &str, + check_node: &ast::Crate, + node_name: &str, ) { - sess.prof.generic_activity_with_arg("pre_AST_expansion_lint_checks", crate_name).run(|| { - rustc_lint::check_ast_crate( + sess.prof.generic_activity_with_arg("pre_AST_expansion_lint_checks", node_name).run(|| { + rustc_lint::check_ast_node( sess, + true, lint_store, - krate, crate_attrs, - true, None, rustc_lint::BuiltinCombinedPreExpansionLintPass::new(), + check_node, ); }); } @@ -265,7 +265,7 @@ pub fn configure_and_expand( resolver: &mut Resolver<'_>, ) -> Result<ast::Crate> { tracing::trace!("configure_and_expand"); - pre_expansion_lint(sess, lint_store, &krate, &krate.attrs, crate_name); + pre_expansion_lint(sess, lint_store, &krate.attrs, &krate, crate_name); rustc_builtin_macros::register_builtin_macros(resolver); krate = sess.time("crate_injection", || { @@ -324,7 +324,7 @@ pub fn configure_and_expand( let crate_attrs = krate.attrs.clone(); let extern_mod_loaded = |ident: Ident, attrs, items, span| { let krate = ast::Crate { attrs, items, span, id: DUMMY_NODE_ID, is_placeholder: false }; - pre_expansion_lint(sess, lint_store, &krate, &crate_attrs, ident.name.as_str()); + pre_expansion_lint(sess, lint_store, &crate_attrs, &krate, ident.name.as_str()); (krate.attrs, krate.items) }; let mut ecx = ExtCtxt::new(sess, cfg, resolver, Some(&extern_mod_loaded)); @@ -499,14 +499,14 @@ pub fn lower_to_hir<'res, 'tcx>( ); sess.time("early_lint_checks", || { - rustc_lint::check_ast_crate( + rustc_lint::check_ast_node( sess, + false, lint_store, - &krate, &krate.attrs, - false, Some(std::mem::take(resolver.lint_buffer())), rustc_lint::BuiltinCombinedEarlyLintPass::new(), + &krate, ) }); |
