Skip to content

Commit 1fcc124

Browse files
Wrap EarlyContext::visit_local/visit_expr in with_lint_attrs calls
LateContext already does this, looks like this was just forgotten in #29850
1 parent fec739b commit 1fcc124

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/librustc/lint/context.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl<'a> LintContext for EarlyContext<'a> {
636636
}
637637

638638
fn enter_attrs(&mut self, attrs: &[ast::Attribute]) {
639-
debug!("early context: exit_attrs({:?})", attrs);
639+
debug!("early context: enter_attrs({:?})", attrs);
640640
run_lints!(self, enter_lint_attrs, early_passes, attrs);
641641
}
642642

@@ -834,8 +834,10 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
834834
}
835835

836836
fn visit_expr(&mut self, e: &ast::Expr) {
837-
run_lints!(self, check_expr, early_passes, e);
838-
ast_visit::walk_expr(self, e);
837+
self.with_lint_attrs(e.attrs.as_attr_slice(), |cx| {
838+
run_lints!(cx, check_expr, early_passes, e);
839+
ast_visit::walk_expr(cx, e);
840+
})
839841
}
840842

841843
fn visit_stmt(&mut self, s: &ast::Stmt) {
@@ -890,8 +892,10 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
890892
}
891893

892894
fn visit_local(&mut self, l: &ast::Local) {
893-
run_lints!(self, check_local, early_passes, l);
894-
ast_visit::walk_local(self, l);
895+
self.with_lint_attrs(l.attrs.as_attr_slice(), |cx| {
896+
run_lints!(cx, check_local, early_passes, l);
897+
ast_visit::walk_local(cx, l);
898+
})
895899
}
896900

897901
fn visit_block(&mut self, b: &ast::Block) {

0 commit comments

Comments
 (0)