-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
std: avoid tearing dbg! prints
#149869
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
base: main
Are you sure you want to change the base?
std: avoid tearing dbg! prints
#149869
Conversation
This comment has been minimized.
This comment has been minimized.
|
Neat solution :) I wasn't sure if we could use helper macros. |
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
| loop { | ||
| let [arm] = arms else { unreachable!("dbg! macro expansion only has single-arm matches") }; | ||
|
|
||
| match is_async_move_desugar(arm.body).unwrap_or(arm.body).peel_drop_temps().kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this is really necessary, I just copied this from above.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Fixes #136703.
This is an alternative to #149859. Instead of formatting everything into a string, this PR makes multi-expression
dbg!expand into multiple nested matches, with the final match containing a singleeprint!. By using macro recursion and relying on hygiene, this allows naming every bound value in thateprint!.CC @orlp
r? libs