rust-lang / rust-lang/rust-analyzer

False macro expansion error in `lazy_static_include_bytes`

Open
#11,521 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macro Broken Window C-bug E-unknown S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

This macro call fails to expand for me:

https://github.com/near/nearcore/blob/d338e91390c9b3ed422c66dbfd2548bcc8282249/genesis-tools/genesis-csv-to-json/src/csv_parser.rs#L345-L347

I think this is related to $vis token producing an empty match, as the following works:

pub RES => "res/test_accounts.csv"

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

Start by reproducing the failure at csv_parser.rs lines 345-347 in the linked nearcore revision, comparing it with the working pub RES form. Then trace rust-analyzer's lazy_static_include_bytes macro expansion around the suspected empty $vis match; done means the original invocation expands successfully without the workaround.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.