-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proc_macro: Fix expand_expr expansion of bool literals #98463
Conversation
Previously, the expand_expr method would expand bool literals as a `Literal` token containing a `LitKind::Bool`, rather than as an `Ident`. This is not a valid token, and the `LitKind::Bool` case needs to be handled seperately. Tests were added to more deeply compare the streams in the expand-expr test suite to catch mistakes like this in the future.
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
Oops, I did not mean to open this as a draft. |
This looks ok to me but I know very little about proc macros. @mystor are there any compatibility issues with this change that you are aware of? Specifically, I'm imagining something like a proc macro that expects to get a token tree of |
I highly doubt that there are any major crates which are using this API, given that it was fairly recently introduced (last november, #87264), and hasn't even been exposed as an unstable API from It appears that only 2 crates even enable the unstable feature (thanks @m-ou-se for helping me search!): https://crates.io/crates/nyar-macro, and https://crates.io/crates/include-transformed. |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (29554c0): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Previously, the expand_expr method would expand bool literals as a
Literal
token containing aLitKind::Bool
, rather than as anIdent
.This is not a valid token, and the
LitKind::Bool
case needs to behandled seperately.
Tests were added to more deeply compare the streams in the expand-expr
test suite to catch mistakes like this in the future.