consider wait()
calls in nested bodies
This commit is contained in:
parent
db1bda3df1
commit
f06a46ee4d
@ -6,6 +6,7 @@
|
|||||||
use rustc_hir::intravisit::{Visitor, walk_block, walk_expr, walk_local};
|
use rustc_hir::intravisit::{Visitor, walk_block, walk_expr, walk_local};
|
||||||
use rustc_hir::{Expr, ExprKind, HirId, LetStmt, Node, PatKind, Stmt, StmtKind};
|
use rustc_hir::{Expr, ExprKind, HirId, LetStmt, Node, PatKind, Stmt, StmtKind};
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
|
use rustc_middle::hir::nested_filter;
|
||||||
use rustc_session::declare_lint_pass;
|
use rustc_session::declare_lint_pass;
|
||||||
use rustc_span::sym;
|
use rustc_span::sym;
|
||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
@ -119,6 +120,7 @@ enum WaitFinder<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Visitor<'tcx> for WaitFinder<'_, 'tcx> {
|
impl<'tcx> Visitor<'tcx> for WaitFinder<'_, 'tcx> {
|
||||||
|
type NestedFilter = nested_filter::OnlyBodies;
|
||||||
type Result = ControlFlow<BreakReason>;
|
type Result = ControlFlow<BreakReason>;
|
||||||
|
|
||||||
fn visit_local(&mut self, l: &'tcx LetStmt<'tcx>) -> Self::Result {
|
fn visit_local(&mut self, l: &'tcx LetStmt<'tcx>) -> Self::Result {
|
||||||
@ -204,6 +206,11 @@ fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) -> Self::Result {
|
|||||||
|
|
||||||
walk_expr(self, ex)
|
walk_expr(self, ex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn nested_visit_map(&mut self) -> Self::Map {
|
||||||
|
let (Self::Found(cx, _) | Self::WalkUpTo(cx, _)) = self;
|
||||||
|
cx.tcx.hir()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function has shared logic between the different kinds of nodes that can trigger the lint.
|
/// This function has shared logic between the different kinds of nodes that can trigger the lint.
|
||||||
|
@ -131,6 +131,13 @@ struct S {
|
|||||||
}
|
}
|
||||||
x.wait().unwrap();
|
x.wait().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut x = Command::new("").spawn().unwrap();
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
x.wait().unwrap();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_child(c: Child) {
|
fn process_child(c: Child) {
|
||||||
|
Loading…
Reference in New Issue
Block a user