diff options
| author | bors <bors@rust-lang.org> | 2022-05-10 12:28:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-10 12:28:34 +0000 |
| commit | cc695363e401e2f8d2da9d2a7282c1bb809d9d57 (patch) | |
| tree | c41c456827595e69b2639fab53008805e3051292 | |
| parent | 460e389f547c908050ad8d49e39aa7d311286645 (diff) | |
| parent | 956b8fb9540a849fca98b09d016c71b76160dd2e (diff) | |
| download | rust-cc695363e401e2f8d2da9d2a7282c1bb809d9d57.tar.gz rust-cc695363e401e2f8d2da9d2a7282c1bb809d9d57.zip | |
Auto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola
fix: don't panic at fully qualified call syntax in signature help Closes #12200 Regressed from #12082
| -rw-r--r-- | crates/ide/src/signature_help.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs index 57b0305fb35..e603cb4862d 100644 --- a/crates/ide/src/signature_help.rs +++ b/crates/ide/src/signature_help.rs @@ -129,7 +129,7 @@ fn signature_help_for_call( hir::CallableKind::Function(func) => { res.doc = func.docs(db).map(|it| it.into()); format_to!(res.signature, "fn {}", func.name(db)); - fn_params = Some(match func.self_param(db) { + fn_params = Some(match callable.receiver_param(db) { Some(_self) => func.params_without_self(db), None => func.assoc_fn_params(db), }); @@ -1142,4 +1142,20 @@ fn f() { "#]], ); } + + #[test] + fn fully_qualified_syntax() { + check( + r#" +fn f() { + trait A { fn foo(&self, other: Self); } + A::foo(&self$0, other); +} +"#, + expect![[r#" + fn foo(self: &Self, other: Self) + ^^^^^^^^^^^ ----------- + "#]], + ); + } } |
