Skip to content

Bad + use<> suggestion in nested macro_rules #133769

Open
@ehuss

Description

@ehuss

Failure in migrating rocket 0.5.1 to 2024 due to the _typed_stream macro getting modified to:

macro_rules! _typed_stream {
    ($S:ident, $($t:tt)*) => (
        $crate::__typed_stream! {
            $crate::response::stream::$S,
            $crate::response::stream::stream,
            $crate::futures::stream::Stream,
            $($t)*
        } + use<'b>
    )
}

where that is invalid syntax. Just removing the + use<'b> seems to make things work?

Unraveling this to a minimal example seems to be quite a bit of work since there are many layers of macros involved. This could also just be an issue with the rocket_codegen proc-macro respanning, but I did not unravel it that far.

Meta

rustc 1.85.0-nightly (5e1440ae5 2024-12-01)
binary: rustc
commit-hash: 5e1440ae514d98ddfcbf1607acb64d41e07ef616
commit-date: 2024-12-01
host: aarch64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2024Area: The 2024 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-editionDiagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-edition-triagedIssue: This issue has been reviewed and triaged by the Edition team.L-impl_trait_overcapturesLint: impl_trait_overcapturesT-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