Skip to content

Commit d315dc6

Browse files
committed
more check_*_post methods for LintPasses
1 parent 64b4b6d commit d315dc6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/librustc/lint/context.rs

+10
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
766766
self.with_lint_attrs(&it.attrs, |cx| {
767767
run_lints!(cx, check_foreign_item, late_passes, it);
768768
hir_visit::walk_foreign_item(cx, it);
769+
run_lints!(cx, check_foreign_item_post, late_passes, it);
769770
})
770771
}
771772

@@ -795,6 +796,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
795796
body: &'v hir::Block, span: Span, id: ast::NodeId) {
796797
run_lints!(self, check_fn, late_passes, fk, decl, body, span, id);
797798
hir_visit::walk_fn(self, fk, decl, body, span);
799+
run_lints!(self, check_fn_post, late_passes, fk, decl, body, span, id);
798800
}
799801

800802
fn visit_variant_data(&mut self,
@@ -835,6 +837,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
835837
fn visit_mod(&mut self, m: &hir::Mod, s: Span, n: ast::NodeId) {
836838
run_lints!(self, check_mod, late_passes, m, s, n);
837839
hir_visit::walk_mod(self, m);
840+
run_lints!(self, check_mod_post, late_passes, m, s, n);
838841
}
839842

840843
fn visit_local(&mut self, l: &hir::Local) {
@@ -874,6 +877,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
874877
run_lints!(cx, check_trait_item, late_passes, trait_item);
875878
cx.visit_ids(|v| v.visit_trait_item(trait_item));
876879
hir_visit::walk_trait_item(cx, trait_item);
880+
run_lints!(cx, check_trait_item_post, late_passes, trait_item);
877881
});
878882
}
879883

@@ -882,6 +886,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
882886
run_lints!(cx, check_impl_item, late_passes, impl_item);
883887
cx.visit_ids(|v| v.visit_impl_item(impl_item));
884888
hir_visit::walk_impl_item(cx, impl_item);
889+
run_lints!(cx, check_impl_item_post, late_passes, impl_item);
885890
});
886891
}
887892

@@ -928,6 +933,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
928933
self.with_lint_attrs(&it.attrs, |cx| {
929934
run_lints!(cx, check_foreign_item, early_passes, it);
930935
ast_visit::walk_foreign_item(cx, it);
936+
run_lints!(cx, check_foreign_item_post, early_passes, it);
931937
})
932938
}
933939

@@ -952,6 +958,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
952958
body: &'v ast::Block, span: Span, id: ast::NodeId) {
953959
run_lints!(self, check_fn, early_passes, fk, decl, body, span, id);
954960
ast_visit::walk_fn(self, fk, decl, body, span);
961+
run_lints!(self, check_fn_post, early_passes, fk, decl, body, span, id);
955962
}
956963

957964
fn visit_variant_data(&mut self,
@@ -992,6 +999,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
992999
fn visit_mod(&mut self, m: &ast::Mod, s: Span, n: ast::NodeId) {
9931000
run_lints!(self, check_mod, early_passes, m, s, n);
9941001
ast_visit::walk_mod(self, m);
1002+
run_lints!(self, check_mod_post, early_passes, m, s, n);
9951003
}
9961004

9971005
fn visit_local(&mut self, l: &ast::Local) {
@@ -1031,6 +1039,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
10311039
run_lints!(cx, check_trait_item, early_passes, trait_item);
10321040
cx.visit_ids(|v| v.visit_trait_item(trait_item));
10331041
ast_visit::walk_trait_item(cx, trait_item);
1042+
run_lints!(cx, check_trait_item_post, early_passes, trait_item);
10341043
});
10351044
}
10361045

@@ -1039,6 +1048,7 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
10391048
run_lints!(cx, check_impl_item, early_passes, impl_item);
10401049
cx.visit_ids(|v| v.visit_impl_item(impl_item));
10411050
ast_visit::walk_impl_item(cx, impl_item);
1051+
run_lints!(cx, check_impl_item_post, early_passes, impl_item);
10421052
});
10431053
}
10441054

src/librustc/lint/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ pub trait LateLintPass: LintPass {
134134
fn check_crate(&mut self, _: &LateContext, _: &hir::Crate) { }
135135
fn check_crate_post(&mut self, _: &LateContext, _: &hir::Crate) { }
136136
fn check_mod(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
137+
fn check_mod_post(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
137138
fn check_foreign_item(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
139+
fn check_foreign_item_post(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
138140
fn check_item(&mut self, _: &LateContext, _: &hir::Item) { }
139141
fn check_item_post(&mut self, _: &LateContext, _: &hir::Item) { }
140142
fn check_local(&mut self, _: &LateContext, _: &hir::Local) { }
@@ -150,8 +152,12 @@ pub trait LateLintPass: LintPass {
150152
fn check_generics(&mut self, _: &LateContext, _: &hir::Generics) { }
151153
fn check_fn(&mut self, _: &LateContext,
152154
_: FnKind, _: &hir::FnDecl, _: &hir::Block, _: Span, _: ast::NodeId) { }
155+
fn check_fn_post(&mut self, _: &LateContext,
156+
_: FnKind, _: &hir::FnDecl, _: &hir::Block, _: Span, _: ast::NodeId) { }
153157
fn check_trait_item(&mut self, _: &LateContext, _: &hir::TraitItem) { }
158+
fn check_trait_item_post(&mut self, _: &LateContext, _: &hir::TraitItem) { }
154159
fn check_impl_item(&mut self, _: &LateContext, _: &hir::ImplItem) { }
160+
fn check_impl_item_post(&mut self, _: &LateContext, _: &hir::ImplItem) { }
155161
fn check_struct_def(&mut self, _: &LateContext,
156162
_: &hir::VariantData, _: ast::Name, _: &hir::Generics, _: ast::NodeId) { }
157163
fn check_struct_def_post(&mut self, _: &LateContext,
@@ -179,7 +185,9 @@ pub trait EarlyLintPass: LintPass {
179185
fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
180186
fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
181187
fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
188+
fn check_mod_post(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
182189
fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
190+
fn check_foreign_item_post(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
183191
fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
184192
fn check_item_post(&mut self, _: &EarlyContext, _: &ast::Item) { }
185193
fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
@@ -195,8 +203,12 @@ pub trait EarlyLintPass: LintPass {
195203
fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
196204
fn check_fn(&mut self, _: &EarlyContext,
197205
_: ast_visit::FnKind, _: &ast::FnDecl, _: &ast::Block, _: Span, _: ast::NodeId) { }
206+
fn check_fn_post(&mut self, _: &EarlyContext,
207+
_: ast_visit::FnKind, _: &ast::FnDecl, _: &ast::Block, _: Span, _: ast::NodeId) { }
198208
fn check_trait_item(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
209+
fn check_trait_item_post(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
199210
fn check_impl_item(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
211+
fn check_impl_item_post(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
200212
fn check_struct_def(&mut self, _: &EarlyContext,
201213
_: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
202214
fn check_struct_def_post(&mut self, _: &EarlyContext,

0 commit comments

Comments
 (0)