Skip to content

Commit

Permalink
Fix ICE #68025
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jan 19, 2020
1 parent c0e02ad commit 2ecc48f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustc_typeck/expr_use_visitor.rs
Expand Up @@ -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 => {}
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/closures/issue-68025.rs
@@ -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(|| {}));
}

0 comments on commit 2ecc48f

Please sign in to comment.