diff options
| author | Shoyu Vanilla (Flint) <modulo641@gmail.com> | 2025-09-22 15:37:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-22 15:37:39 +0000 |
| commit | 06ee0ef31f849faa5a43b307323f6ddd4a70920f (patch) | |
| tree | c61ee66c8f7053d35b213a9f00be16f0b92b0124 | |
| parent | 44f3de3d4370f681d2255f77417cdb6ee850446e (diff) | |
| parent | 603d64c3bb61e5e39bf624cc152fe1b844e70220 (diff) | |
| download | rust-06ee0ef31f849faa5a43b307323f6ddd4a70920f.tar.gz rust-06ee0ef31f849faa5a43b307323f6ddd4a70920f.zip | |
Merge pull request #20679 from A4-Tacks/no-comp-ty-in-nested-pat
Fix complete type in nested pattern
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs | 1 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs index 60ec1128233..312d3bd426f 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render/pattern.rs @@ -163,6 +163,7 @@ fn render_pat( PatternContext { param_ctx: Some(ParamContext { kind: ParamKind::Function(_), .. }), has_type_ascription: false, + parent_pat: None, .. } ); diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs b/src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs index 9ec27252fd7..6eb0b818d69 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/tests/pattern.rs @@ -399,6 +399,25 @@ fn foo($0) {} } #[test] +fn completes_in_fn_param_in_nested_pattern() { + check( + r#" +struct Foo { num: u32 } +struct Bar(Foo); +fn foo(Bar($0)) {} +"#, + expect![[r#" + st Bar + st Foo + bn Bar(…) Bar($1)$0 + bn Foo {…} Foo { num$1 }$0 + kw mut + kw ref + "#]], + ) +} + +#[test] fn completes_in_closure_param() { check( r#" |
