rust-lang / rust-lang/rust-analyzer

Empty macro that recurses twice per invocation causes r-a to hang up

Open
#10,606 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macro A-nameres C-bug I-hang S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

The following macro causes r-a to hang, trying to expand the macro for a very long time(it will never finish) as this visits every branch of the expansion tree up to depth 128(our current limit).

macro_rules! error {
    () => {
        error! {}
        error! {}
    }
}

error! {}

cc https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Infinitely.20recursing.20.20duplicating.20empty.20expansions

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

The issue gives only a Rust macro reproducer, not a file or test path. Start by reproducing it in rust-analyzer's macro-expansion handling; done means this recursive empty macro no longer hangs and the behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.