-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
trace_macro: Show both the macro call and its expansion. #42072. #42103
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks! We'll get @pnkfelix on the case soon! |
Thanks for the PR! For some time now notes accepts multiline strings. Given that there's some duplication, I'm wondering wether it'd be nice to have output along the lines of:
|
In the particular test in this patch, the TokenStreams mostly fit on one line each, but I suspect that's rare in practice. Here's a noisier example: note: trace_macro
--> main.rs:5:5
|
5 | assert_eq!(vec![1, 2, 3,].len(), 3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `assert_eq! { vec ! [ 1 , 2 , 3 , ] . len ( ) , 3 }`
= note: to `{
match ( & vec!(1 , 2 , 3 ,).len() , & 3 ) {
( left_val , right_val ) => {
if ! ( * left_val == * right_val ) {
panic ! (
"assertion failed: `(left == right)` \
(left: `{:?}`, right: `{:?}`)"
, left_val , right_val ) } } } }`
= note: expanding `panic! { "assertion failed: `(left == right)` \
(left: `{:?}`, right: `{:?}`)"
, left_val , right_val }`
= note: to `{
$crate :: rt :: begin_panic_fmt (
& format_args ! (
"assertion failed: `(left == right)` (left: `{:?}`, right: `{:?}`)" , left_val
, right_val ) , {
static _FILE_LINE : ( & 'static str , u32 ) = ( file ! ( ) , line ! ( ) ) ;
& _FILE_LINE } ) }` Note also that the second |
@bors r+ @jorendorff can you file a ticket to handle that case? |
📌 Commit f8b66a0 has been approved by |
trace_macro: Show both the macro call and its expansion. rust-lang#42072. See rust-lang#42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
trace_macro: Show both the macro call and its expansion. rust-lang#42072. See rust-lang#42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
trace_macro: Show both the macro call and its expansion. rust-lang#42072. See rust-lang#42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
⌛ Testing commit f8b66a0 with merge 5469410... |
💔 Test failed - status-appveyor |
@bors retry
|
trace_macro: Show both the macro call and its expansion. rust-lang#42072. See rust-lang#42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
trace_macro: Show both the macro call and its expansion. rust-lang#42072. See rust-lang#42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
☀️ Test successful - status-appveyor, status-travis |
See #42072 for the initial motivation behind this.
The change is not the minimal fix, but I want this behavior almost every time I use
trace_macros
.