rust-lang / rust-lang/rust-analyzer
rust-analyzer should not emit macro-errors when macro input contains an unclosed delimiter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Something which frequently frustrates me with rust-analyzer:
- I am editing a Kas widget (to reproduce: clone Kas, pick any widget (but especially a large one; maybe try
Spinner), and start typing a newfnwith an unclosed brace:{) - RA correctly emits
[rust-analyzer] (syntax-error) Syntax Error: expected R_CURLY
- RA also emits
[rust-analyzer] (macro-error) unexpected end of input, expected one of:
enum,struct,type,union
The latter error causes the whole impl_scope to be marked as erroneous by the editor, making it harder to focus on the actual error.
Meanwhile, cargo check will only report
error: this file contains an unclosed delimiter
[details omitted]
Macros cannot be evaluated on input that won't even tokenize.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic sequence by following the Kas widget example and typing an unclosed brace in a new function. Trace where rust-analyzer produces the macro-error alongside the syntax-error; done means only the unclosed-delimiter syntax diagnostic remains and the surrounding impl_scope is not marked erroneous.
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
- 48/100