Closed
Description
This the the lib.rs of a proc macro crate pm
:
use proc_macro::TokenStream;
#[proc_macro]
pub fn pm(input: TokenStream) -> TokenStream {
// It works if this is `format!("{}", input)`
format!("{:?}", input);
TokenStream::new()
}
And here is the main.rs of another crate:
macro_rules! t {
// It works if I take a tt
($s:stmt) => {
pm::pm!($s);
}
}
t!(;);
When building, this outputs:
error: proc macro panicked
--> src/lib.rs:3:9
|
3 | pm::pm!($s);
| ^^^^^^^^^^^^
...
7 | t!(;);
| ------ in this macro invocation
|
= help: message: Missing tokens at src/lib.rs:3:16: 3:18 (#6) for nt ";"
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
Version it worked on
1.49.0, 1.50.0-beta.5
Version with regression
rustc 1.51.0-nightly (da305a2 2021-01-05)
binary: rustc
commit-hash: da305a2
commit-date: 2021-01-05
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Procedural macrosCategory: This is a bug.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.