Skip to content

Commit 2ecc48f

Browse files
committed
Fix ICE #68025
1 parent c0e02ad commit 2ecc48f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/librustc_typeck/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,10 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
327327
}
328328

329329
fn walk_callee(&mut self, call: &hir::Expr<'_>, callee: &hir::Expr<'_>) {
330-
let callee_ty = return_if_err!(self.mc.expr_ty_adjusted(callee));
330+
let callee_ty = self.mc.tables.expr_ty_adjusted(callee);
331331
debug!("walk_callee: callee={:?} callee_ty={:?}", callee, callee_ty);
332332
match callee_ty.kind {
333-
ty::FnDef(..) | ty::FnPtr(_) => {
333+
ty::FnDef(..) | ty::FnPtr(_) | ty::Closure(..) => {
334334
self.consume_expr(callee);
335335
}
336336
ty::Error => {}

src/test/ui/closures/issue-68025.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
3+
fn foo<F, G>(_: G, _: Box<F>)
4+
where
5+
F: Fn(),
6+
G: Fn(Box<F>),
7+
{
8+
}
9+
10+
fn main() {
11+
foo(|f| (*f)(), Box::new(|| {}));
12+
}

0 commit comments

Comments
 (0)