rust-lang / rust-lang/rust-analyzer

Nonsensical E0308 on some macro invocations

Open
#22,877 7 comments 7 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.2981-standalone

rustc version: 1.97.0

editor or extension: VSCodium 1.126.04524

relevant settings: nothing special

repository link (if public, optional): adc-lang

No code examples here because they need quite a lot of context, links to offending areas: 1 2 3 4

On these specific macro invocations, rust-analyzer persistently shows the error expected [u8; 1], found [{unknown}; 0] (E0308). It points to column 1 and doesn't suggest any fixes. These macros are used many other times with no issues, and I can't spot anything specific about these instances.

It also somehow messes up the total error count:
Image

Should be reproducible just by cloning and viewing my project. Please let me know if you need more info!

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

Clone the linked adc-lang project and reproduce the diagnostics in rust-analyzer using the reported versions. Start with the macro invocations at src/fns.rs lines 558, 585, and 610, and src/os.rs line 683; compare them with other successful invocations. Done means identifying why these sites produce the spurious E0308 and adding a regression case with correct error reporting.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.