Skip to content

Odd macro expansion errors with nested macros #95605

Closed
@ThePuzzlemaker

Description

@ThePuzzlemaker

Code

I apologize that I can't get a full MCVE going at the moment.
The macro is defined in calypso_diagnostic/src/types.rs and used in calypso_parsing/src/lexer.rs. I originally thought this was related to #52234 after testing in the playground, but I'm not sure anymore as I've tried some workarounds that worked in the playground that did not work here, and did not change anything about the odd behaviour of rustc here.

I expected to see this happen: The program builds

Instead, this happened:

 error: no rules expected the token `E0001`
   --> libs/calypso_parsing/src/lexer.rs:276:55
    |
276 | ...                   b.code("E0001").short(err!(E0001)).label(
    |                                             ^^^^^^^^^^^ no rules expected this token in macro call
    |
    = note: this error originates in the macro `err` (in Nightly builds, run with -Z macro-backtrace for more info)

error: no rules expected the token `E0001`
   --> libs/calypso_parsing/src/lexer.rs:308:51
    |
308 | ...                   b.code("E0001").short(err!(E0001)).label(
    |                                             ^^^^^^^^^^^ no rules expected this token in macro call
    |
    = note: this error originates in the macro `err` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `calypso_parsing` due to 2 previous errors

Version it worked on

It most recently worked on: 1.59.0

Version with regression

rustc --version --verbose:

rustc 1.61.0-nightly (eb82facb1 2022-04-01)
binary: rustc
commit-hash: eb82facb1626166188d49599a3313fc95201f556
commit-date: 2022-04-01
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

@rustbot modify labels: +regression-from-stable-to-nightly +E-needs-mcve +E-needs-bisection

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions