Auto merge of #17481 - roife:fix-issue-17480, r=Veykril

fix: pattern completions in let-stmt

fix #17480.

We can write `let S { a, b } = s;` or `let Some(x) = a else {}`, so it is reasonable to allow pattern completions in `LetStmt`.
This commit is contained in:
bors 2024-06-24 07:34:08 +00:00
commit 3432ef4414
2 changed files with 2 additions and 2 deletions

View file

@ -1334,7 +1334,7 @@ fn pattern_context_for(
.map_or((PatternRefutability::Irrefutable, false), |node| {
let refutability = match_ast! {
match node {
ast::LetStmt(let_) => return (PatternRefutability::Irrefutable, let_.ty().is_some()),
ast::LetStmt(let_) => return (PatternRefutability::Refutable, let_.ty().is_some()),
ast::Param(param) => {
let has_type_ascription = param.ty().is_some();
param_ctx = (|| {

View file

@ -146,7 +146,7 @@ enum SingleVariantEnum {
}
use SingleVariantEnum::Variant;
fn foo() {
let a$0
for a$0
}
"#,
expect![[r#"