Don't require visit_body
to take a lifetime that must outlive the function call
This commit is contained in:
parent
5870f1ccbb
commit
ceb45d5519
20 changed files with 27 additions and 31 deletions
|
@ -125,7 +125,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
|
|||
});
|
||||
}
|
||||
|
||||
fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
|
||||
fn visit_body(&mut self, body: &hir::Body<'tcx>) {
|
||||
lint_callback!(self, check_body, body);
|
||||
hir_visit::walk_body(self, body);
|
||||
lint_callback!(self, check_body_post, body);
|
||||
|
|
|
@ -68,11 +68,11 @@ impl_lint_pass!(NonLocalDefinitions => [NON_LOCAL_DEFINITIONS]);
|
|||
// instead check_mod is called after every body has been handled.
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
|
||||
fn check_body(&mut self, _cx: &LateContext<'tcx>, _body: &'tcx Body<'tcx>) {
|
||||
fn check_body(&mut self, _cx: &LateContext<'tcx>, _body: &Body<'tcx>) {
|
||||
self.body_depth += 1;
|
||||
}
|
||||
|
||||
fn check_body_post(&mut self, _cx: &LateContext<'tcx>, _body: &'tcx Body<'tcx>) {
|
||||
fn check_body_post(&mut self, _cx: &LateContext<'tcx>, _body: &Body<'tcx>) {
|
||||
self.body_depth -= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ use rustc_session::lint::LintPass;
|
|||
macro_rules! late_lint_methods {
|
||||
($macro:path, $args:tt) => (
|
||||
$macro!($args, [
|
||||
fn check_body(a: &'tcx rustc_hir::Body<'tcx>);
|
||||
fn check_body_post(a: &'tcx rustc_hir::Body<'tcx>);
|
||||
fn check_body(a: &rustc_hir::Body<'tcx>);
|
||||
fn check_body_post(a: &rustc_hir::Body<'tcx>);
|
||||
fn check_crate();
|
||||
fn check_crate_post();
|
||||
fn check_mod(a: &'tcx rustc_hir::Mod<'tcx>, b: rustc_hir::HirId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue