rust-lang / rust-lang/rust-analyzer
rust-analyzer's function argument tooltip shows wrong `impl Trait` type.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.0.0 (ce3644694 2022-06-30)
rustc version: cargo 1.62.0-nightly (a44758ac8 2022-05-04)
For this code:
trait Foo{}
fn foo(_x: impl Foo){}
trait Bar{}
fn bar() -> impl Bar { }
impl Bar for (){}
impl<T:Bar> Foo for T{}
fn main() {
let a = bar();
foo(┃a); // tooltip when completing arguments: fn foo(_x: impl Bar)
// expected: fn foo(_x: impl Foo)
}
I expect RA to show impl Foo when completing arguments (Ctrl+Shift+Space) from within function call parentheses.
However, it shows as if function accepts another trait impl, being influenced by the type of the variable that is passed into the function call.
Tooltop for the function itself correctly shows impl Foo instead, and I expect argument completion tooltip to match the documentation tooltip unless RA lacks some info.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Rust example in the issue and reproduce the argument-completion tooltip using Ctrl+Shift+Space. Compare it with the function's documentation tooltip; done means argument completion displays fn foo(_x: impl Foo) rather than using the passed variable's impl Bar type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100