Skip to content

Commit a8fa841

Browse files
committed
Add _post methods for blocks and crates
1 parent 3f4227a commit a8fa841

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustc/lint/context.rs

+6
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
846846
fn visit_block(&mut self, b: &hir::Block) {
847847
run_lints!(self, check_block, late_passes, b);
848848
hir_visit::walk_block(self, b);
849+
run_lints!(self, check_block_post, late_passes, b);
849850
}
850851

851852
fn visit_arm(&mut self, a: &hir::Arm) {
@@ -1001,6 +1002,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
10011002
fn visit_block(&mut self, b: &ast::Block) {
10021003
run_lints!(self, check_block, early_passes, b);
10031004
ast_visit::walk_block(self, b);
1005+
run_lints!(self, check_block_post, early_passes, b);
10041006
}
10051007

10061008
fn visit_arm(&mut self, a: &ast::Arm) {
@@ -1253,6 +1255,8 @@ pub fn check_crate(tcx: &ty::ctxt, access_levels: &AccessLevels) {
12531255
run_lints!(cx, check_crate, late_passes, krate);
12541256

12551257
hir_visit::walk_crate(cx, krate);
1258+
1259+
run_lints!(cx, check_crate_post, late_passes, krate);
12561260
});
12571261

12581262
// If we missed any lints added to the session, then there's a bug somewhere
@@ -1284,6 +1288,8 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
12841288
run_lints!(cx, check_crate, early_passes, krate);
12851289

12861290
ast_visit::walk_crate(cx, krate);
1291+
1292+
run_lints!(cx, check_crate_post, early_passes, krate);
12871293
});
12881294

12891295
// Put the lint store back in the session.

src/librustc/lint/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,13 @@ pub trait LintPass {
132132
pub trait LateLintPass: LintPass {
133133
fn check_name(&mut self, _: &LateContext, _: Span, _: ast::Name) { }
134134
fn check_crate(&mut self, _: &LateContext, _: &hir::Crate) { }
135+
fn check_crate_post(&mut self, _: &LateContext, _: &hir::Crate) { }
135136
fn check_mod(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
136137
fn check_foreign_item(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
137138
fn check_item(&mut self, _: &LateContext, _: &hir::Item) { }
138139
fn check_local(&mut self, _: &LateContext, _: &hir::Local) { }
139140
fn check_block(&mut self, _: &LateContext, _: &hir::Block) { }
141+
fn check_block_post(&mut self, _: &LateContext, _: &hir::Block) { }
140142
fn check_stmt(&mut self, _: &LateContext, _: &hir::Stmt) { }
141143
fn check_arm(&mut self, _: &LateContext, _: &hir::Arm) { }
142144
fn check_pat(&mut self, _: &LateContext, _: &hir::Pat) { }
@@ -174,11 +176,13 @@ pub trait LateLintPass: LintPass {
174176
pub trait EarlyLintPass: LintPass {
175177
fn check_ident(&mut self, _: &EarlyContext, _: Span, _: ast::Ident) { }
176178
fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
179+
fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
177180
fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
178181
fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
179182
fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
180183
fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
181184
fn check_block(&mut self, _: &EarlyContext, _: &ast::Block) { }
185+
fn check_block_post(&mut self, _: &EarlyContext, _: &ast::Block) { }
182186
fn check_stmt(&mut self, _: &EarlyContext, _: &ast::Stmt) { }
183187
fn check_arm(&mut self, _: &EarlyContext, _: &ast::Arm) { }
184188
fn check_pat(&mut self, _: &EarlyContext, _: &ast::Pat) { }

0 commit comments

Comments
 (0)