Skip to content

Incorrect span when encountering incorrect opening delimiter in macro fragments #55322

Closed
@estebank

Description

@estebank

When writing a macro rule that tries to accept a () after a path, we correctly inform the user that ( cannot come after a path, but we point at the following character:

error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
  --> $DIR/macro-follow.rs:104:15
   |
LL |     ($p:path ()) => {};
   |               ^

This is probably an off-by-one error in the span assignment of the tokens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions