Skip to content

rust-analyzer should not emit macro-errors when macro input contains an unclosed delimiter #19782

Open
@dhardy

Description

@dhardy

Something which frequently frustrates me with rust-analyzer:

  1. 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 new fn with an unclosed brace: {)
  2. RA correctly emits

    [rust-analyzer] (syntax-error) Syntax Error: expected R_CURLY

  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions