PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: rust-lang/rust-analyzer (rust)

Issue:
Type completion during `let-else` statement
Type completion works in `if let`  but not in `let-else`:

<img width="339" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/30187863/bf2089e2-6dbc-40dc-97c5-74be59c71aac">



<img width="339" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/30187863/14010007-a67a-4543-8380-15280711d71d">


Pull request:
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`.

Patch:
diff --git a/crates/ide-completion/src/context/analysis.rs b/crates/ide-completion/src/context/analysis.rs
index 80ce5bd4cf..743aa00570 100644
--- a/crates/ide-completion/src/context/analysis.rs
+++ b/crates/ide-completion/src/context/analysis.rs
@@ -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 = (|| {


Test patch:
diff --git a/crates/ide-completion/src/tests/pattern.rs b/crates/ide-completion/src/tests/pattern.rs
index 8720cb555a..6a0b67e291 100644
--- a/crates/ide-completion/src/tests/pattern.rs
+++ b/crates/ide-completion/src/tests/pattern.rs
@@ -146,7 +146,7 @@ enum SingleVariantEnum {
 }
 use SingleVariantEnum::Variant;
 fn foo() {
-   let a$0
+   for a$0
 }
 "#,
         expect![[r#"