This commit is contained in:
Yuki Okushi 2020-01-10 05:08:02 +09:00
parent c0e02ad724
commit 2ecc48ffa1
2 changed files with 14 additions and 2 deletions

View file

@ -327,10 +327,10 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
}
fn walk_callee(&mut self, call: &hir::Expr<'_>, callee: &hir::Expr<'_>) {
let callee_ty = return_if_err!(self.mc.expr_ty_adjusted(callee));
let callee_ty = self.mc.tables.expr_ty_adjusted(callee);
debug!("walk_callee: callee={:?} callee_ty={:?}", callee, callee_ty);
match callee_ty.kind {
ty::FnDef(..) | ty::FnPtr(_) => {
ty::FnDef(..) | ty::FnPtr(_) | ty::Closure(..) => {
self.consume_expr(callee);
}
ty::Error => {}

View file

@ -0,0 +1,12 @@
// check-pass
fn foo<F, G>(_: G, _: Box<F>)
where
F: Fn(),
G: Fn(Box<F>),
{
}
fn main() {
foo(|f| (*f)(), Box::new(|| {}));
}