rust-lang / rust-lang/rust-analyzer

Autocomplete not working when line is not terminated with semicolon in macro annotated method

Open
#20,747 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer 1.90.0 (1159e78 2025-09-14)

rustc version: rustc 1.90.0 (1159e78c4 2025-09-14)

editor or extension: Zed 0.205.5

code snippet to reproduce:

#[faux::create]
struct S {
    a: i32,
}

#[faux::methods]
impl S {
    fn do_work(&mut self) {
        let s = "abcd";
        //let n = s.len();
        self.a = 0;
    }
}

When typing the commented line, I don't get a suggestion for len method or any other methods.
If I put semicolon in the end in advance, then it starts working.
Also if I remove macros annotations then it starts working as expected too.

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 issue in rust-analyzer using the provided Rust snippet and the stated Zed and rustc versions. Compare completion for s.len() with and without the macro annotations and prewritten semicolon; done means method suggestions appear while the statement is still incomplete.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.