-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use diagnostics for trace_macro instead of println #41520
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Do we have any tests of this feature? Maybe make a |
708d494
to
929240d
Compare
That's... a ton of extra noise, compared to:
especially if a macro has multiple expansion steps. What's the concrete benefit to users of the feature, here? Can you at least get rid of the "macro in external crate" bit? |
@durka line numbers seem like a win, but if they're just repeated N times, perhaps less useful that way. We could presumably make these attached |
Maybe it's possible to attach all the expansion steps to one span? Like this:
That would in fact be better than the current output, where you have to wade through all of it to find a particular macro's expansion. The rightward drift still bugs me a bit. |
@durka yes that was roughly what I had in mind, but probably more like
|
@estebank - just a friendly ping to keep this on your radar |
c49cc0e
to
0fabc21
Compare
Updated. |
@bors r+ |
📌 Commit 8c9ad8d has been approved by |
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix rust-lang#22597.
☔ The latest upstream changes (presumably #41846) made this pull request unmergeable. Please resolve the merge conflicts. |
When using
trace_macro
, usespan_label
s instead ofprintln
:Fix #22597.