Skip to content

Commit

Permalink
Auto merge of rust-lang#12202 - iDawer:ide.sig_help-fix, r=lnicola
Browse files Browse the repository at this point in the history
fix: don't panic at fully qualified call syntax in signature help

Closes  rust-lang#12200
Regressed from rust-lang#12082
  • Loading branch information
bors committed May 10, 2022
2 parents 460e389 + 956b8fb commit cc69536
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion crates/ide/src/signature_help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
Expand Down Expand Up @@ -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)
^^^^^^^^^^^ -----------
"#]],
);
}
}

0 comments on commit cc69536

Please sign in to comment.