rust-lang / rust-lang/rust-analyzer

`dbg` postfix completion should take adjustments into account

Open
#17,597 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-completion C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

struct S;
impl S {
    fn borrow(&self) {}
}
fn main() {
    S$0.borrow();
}

doing a .dbg completion at $0 results in dbg!(S).borrow() which is a compile error. We should instead emit a dbg!(&S).borrow() here

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the .dbg postfix completion with the provided S::borrow example, then locate the implementation and its completion tests. Check how expression adjustments are represented and add a regression case showing that the generated completion preserves the required borrow; run the relevant completion test suite and verify the output is dbg!(&S).borrow().

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.