Skip to content

Commit 97255d1

Browse files
committed
v3
1 parent c0f6fd4 commit 97255d1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/hir-ty/src/infer/expr.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ impl InferenceContext<'_> {
334334
ExprIsRead::No
335335
};
336336
let input_ty = self.infer_expr(expr, &Expectation::none(), child_is_read);
337-
self.infer_top_pat(pat, &input_ty, None);
337+
self.infer_top_pat(
338+
pat,
339+
&input_ty,
340+
Some(DeclContext { origin: DeclOrigin::LetExpr }),
341+
);
338342
self.result.standard_types.bool_.clone()
339343
}
340344
Expr::Block { statements, tail, label, id } => {

crates/hir-ty/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,11 @@ pub fn known_const_to_ast(
10521052

10531053
#[derive(Debug, Copy, Clone)]
10541054
pub(crate) enum DeclOrigin {
1055+
LetExpr,
10551056
/// from `let x = ..`
1056-
LocalDecl { has_else: bool },
1057+
LocalDecl {
1058+
has_else: bool,
1059+
},
10571060
}
10581061

10591062
/// Provides context for checking patterns in declarations. More specifically this

0 commit comments

Comments
 (0)