rust-lang / rust-lang/rust-analyzer

"invalid tokens" macro error with custom-format crate

Open
#21,724 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: 0.3.2803-standalone

rustc version: 1.93.0

editor or extension: VSCode extension version 0.3.2803

relevant settings: none?

repository link (if public, optional): https://github.com/x-hgg-x/custom-format

code snippet to reproduce:

fn main() {
    custom_format::println!("hello");
}

Produces "invalid tokens" macro error in rust-analyzer whenever pretty much any of the macros from custom_format are used, even in trivial examples like the above. The compiler is fine with it.

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 with the provided main function and the custom_format::println!("hello") invocation, then compare rust-analyzer's "invalid tokens" diagnostic with rustc's successful compilation. Reproduce the issue across the custom-format macros mentioned in the report; done means rust-analyzer no longer reports the false macro error while compiler behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
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.