Stop emitting lints during lowering.
This commit is contained in:
parent
c10a1cebe7
commit
4b598d3f75
3 changed files with 15 additions and 24 deletions
|
@ -57,7 +57,6 @@ use rustc_hir::intravisit;
|
||||||
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
|
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
|
||||||
use rustc_index::vec::{Idx, IndexVec};
|
use rustc_index::vec::{Idx, IndexVec};
|
||||||
use rustc_query_system::ich::StableHashingContext;
|
use rustc_query_system::ich::StableHashingContext;
|
||||||
use rustc_session::lint::LintBuffer;
|
|
||||||
use rustc_session::parse::feature_err;
|
use rustc_session::parse::feature_err;
|
||||||
use rustc_session::utils::{FlattenNonterminals, NtToTokenstream};
|
use rustc_session::utils::{FlattenNonterminals, NtToTokenstream};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
|
@ -180,8 +179,6 @@ pub trait ResolverAstLowering {
|
||||||
|
|
||||||
fn definitions(&self) -> &Definitions;
|
fn definitions(&self) -> &Definitions;
|
||||||
|
|
||||||
fn lint_buffer(&mut self) -> &mut LintBuffer;
|
|
||||||
|
|
||||||
fn next_node_id(&mut self) -> NodeId;
|
fn next_node_id(&mut self) -> NodeId;
|
||||||
|
|
||||||
fn take_trait_map(&mut self, node: NodeId) -> Option<Vec<hir::TraitCandidate>>;
|
fn take_trait_map(&mut self, node: NodeId) -> Option<Vec<hir::TraitCandidate>>;
|
||||||
|
|
|
@ -487,12 +487,24 @@ pub fn configure_and_expand(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sess.time("early_lint_checks", || {
|
||||||
|
let lint_buffer = Some(std::mem::take(resolver.lint_buffer()));
|
||||||
|
rustc_lint::check_ast_node(
|
||||||
|
sess,
|
||||||
|
false,
|
||||||
|
lint_store,
|
||||||
|
resolver.registered_tools(),
|
||||||
|
lint_buffer,
|
||||||
|
rustc_lint::BuiltinCombinedEarlyLintPass::new(),
|
||||||
|
&krate,
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
Ok(krate)
|
Ok(krate)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lower_to_hir<'res, 'tcx>(
|
pub fn lower_to_hir<'res, 'tcx>(
|
||||||
sess: &'tcx Session,
|
sess: &'tcx Session,
|
||||||
lint_store: &LintStore,
|
|
||||||
resolver: &'res mut Resolver<'_>,
|
resolver: &'res mut Resolver<'_>,
|
||||||
krate: Rc<ast::Crate>,
|
krate: Rc<ast::Crate>,
|
||||||
arena: &'tcx rustc_ast_lowering::Arena<'tcx>,
|
arena: &'tcx rustc_ast_lowering::Arena<'tcx>,
|
||||||
|
@ -506,19 +518,6 @@ pub fn lower_to_hir<'res, 'tcx>(
|
||||||
arena,
|
arena,
|
||||||
);
|
);
|
||||||
|
|
||||||
sess.time("early_lint_checks", || {
|
|
||||||
let lint_buffer = Some(std::mem::take(resolver.lint_buffer()));
|
|
||||||
rustc_lint::check_ast_node(
|
|
||||||
sess,
|
|
||||||
false,
|
|
||||||
lint_store,
|
|
||||||
resolver.registered_tools(),
|
|
||||||
lint_buffer,
|
|
||||||
rustc_lint::BuiltinCombinedEarlyLintPass::new(),
|
|
||||||
&*krate,
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Drop AST to free memory
|
// Drop AST to free memory
|
||||||
sess.time("drop_ast", || std::mem::drop(krate));
|
sess.time("drop_ast", || std::mem::drop(krate));
|
||||||
|
|
||||||
|
@ -852,9 +851,8 @@ pub fn create_global_ctxt<'tcx>(
|
||||||
dep_graph.assert_ignored();
|
dep_graph.assert_ignored();
|
||||||
|
|
||||||
let sess = &compiler.session();
|
let sess = &compiler.session();
|
||||||
let krate = resolver
|
let krate =
|
||||||
.borrow_mut()
|
resolver.borrow_mut().access(|resolver| lower_to_hir(sess, resolver, krate, hir_arena));
|
||||||
.access(|resolver| lower_to_hir(sess, &lint_store, resolver, krate, hir_arena));
|
|
||||||
let resolver_outputs = BoxedResolver::to_resolver_outputs(resolver);
|
let resolver_outputs = BoxedResolver::to_resolver_outputs(resolver);
|
||||||
|
|
||||||
let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);
|
let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);
|
||||||
|
|
|
@ -1204,10 +1204,6 @@ impl ResolverAstLowering for Resolver<'_> {
|
||||||
&self.definitions
|
&self.definitions
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lint_buffer(&mut self) -> &mut LintBuffer {
|
|
||||||
&mut self.lint_buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
fn next_node_id(&mut self) -> NodeId {
|
fn next_node_id(&mut self) -> NodeId {
|
||||||
self.next_node_id()
|
self.next_node_id()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue