Bad `+ use<>` suggestion in nested macro_rules
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
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
Start by reproducing the report with rustc 1.85.0-nightly and Rocket's _typed_stream macro in core/lib/src/response/stream/mod.rs:292-301. Trace the nested macro expansion and the rocket_codegen proc-macro respanning to determine why + use<'b> is suggested; done means the expansion no longer produces invalid syntax.
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
- Needs clarification
- Newbie friendliness
- 35/100