Closed Kyuuhachi closed 1 year ago
This is a rustc bug — paste!
expands this input correctly (preserving the None
-delimited group) but rustc's parser that is used for parsing the tokens returned by a proc macro just totally ignores None
-delimited groups as if they were not grouped at all. See https://github.com/rust-lang/rust/issues/67062.
The below example requires parentheses around the
$val
to compile, which it doesn't withoutpaste
.The correct resulting token tree would be
⟦⟦&A⟧.clone()⟧.consume_self()
, but with paste, it appears to be flattened to⟦&A.clone()⟧.consume_self()
.The docs do say null delimiters might not survive roundtripping, but I think it should be possible to avoid here.