Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/closure.rs')
-rw-r--r--crates/hir-ty/src/infer/closure.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/hir-ty/src/infer/closure.rs b/crates/hir-ty/src/infer/closure.rs
index 6d03c76eb6..cd8bd10255 100644
--- a/crates/hir-ty/src/infer/closure.rs
+++ b/crates/hir-ty/src/infer/closure.rs
@@ -123,9 +123,14 @@ impl HirPlace {
fn ty(&self, ctx: &mut InferenceContext<'_>) -> Ty {
let mut ty = ctx.table.resolve_completely(ctx.result[self.local].clone());
for p in &self.projections {
- ty = p.projected_ty(ty, ctx.db, |_, _, _| {
- unreachable!("Closure field only happens in MIR");
- });
+ ty = p.projected_ty(
+ ty,
+ ctx.db,
+ |_, _, _| {
+ unreachable!("Closure field only happens in MIR");
+ },
+ ctx.owner.module(ctx.db.upcast()).krate(),
+ );
}
ty.clone()
}
@@ -447,7 +452,6 @@ impl InferenceContext<'_> {
}
}
Expr::Async { statements, tail, .. }
- | Expr::Const { statements, tail, .. }
| Expr::Unsafe { statements, tail, .. }
| Expr::Block { statements, tail, .. } => {
for s in statements.iter() {
@@ -605,6 +609,7 @@ impl InferenceContext<'_> {
| Expr::Continue { .. }
| Expr::Path(_)
| Expr::Literal(_)
+ | Expr::Const(_)
| Expr::Underscore => (),
}
}