X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Fearly.rs;h=337a19dd024d2fec195601c77de253036df847bf;hb=00efb0cb960e4b89a80cad7d44fa0eefd223f513;hp=c18abaef8e2565e450bffb1959adfdf5dde7532b;hpb=405e48f1ac0297fde1fdc49ea45b0ba5acc977bd;p=rust.git diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index c18abaef8e2..337a19dd024 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -19,6 +19,7 @@ use rustc_ast::ptr::P; use rustc_ast::visit::{self as ast_visit, Visitor}; use rustc_ast::{self as ast, walk_list, HasAttrs}; +use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_middle::ty::RegisteredTools; use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass}; use rustc_session::Session; @@ -39,6 +40,7 @@ pub struct EarlyContextAndPass<'a, T: EarlyLintPass> { impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> { // This always-inlined function is for the hot call site. #[inline(always)] + #[allow(rustc::diagnostic_outside_of_impl)] fn inlined_check_id(&mut self, id: ast::NodeId) { for early_lint in self.context.buffered.take(id) { let BufferedEarlyLint { span, msg, node_id: _, lint_id, diagnostic } = early_lint; @@ -71,7 +73,7 @@ fn with_lint_attrs(&mut self, id: ast::NodeId, attrs: &'a [ast::Attribute], f self.inlined_check_id(id); debug!("early context: enter_attrs({:?})", attrs); lint_callback!(self, enter_lint_attrs, attrs); - f(self); + ensure_sufficient_stack(|| f(self)); debug!("early context: exit_attrs({:?})", attrs); lint_callback!(self, exit_lint_attrs, attrs); self.context.builder.pop(push); @@ -246,7 +248,9 @@ fn visit_generics(&mut self, g: &'a ast::Generics) { } fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) { + lint_callback!(self, enter_where_predicate, p); ast_visit::walk_where_predicate(self, p); + lint_callback!(self, exit_where_predicate, p); } fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef) {