Skip to content
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

New trace_macros! messages are inaccurate #42072

Closed
jorendorff opened this issue May 17, 2017 · 2 comments
Closed

New trace_macros! messages are inaccurate #42072

jorendorff opened this issue May 17, 2017 · 2 comments

Comments

@jorendorff
Copy link
Contributor

jorendorff commented May 17, 2017

https://is.gd/8JnZ5V

#![feature(trace_macros)]

fn main() {
    trace_macros!(true);
    assert_eq!(vec![1, 2, 3,].len(), 3);
}

Output is:

rustc 1.19.0-nightly (75b056812 2017-05-15)
note: trace_macro
 --> <anon>:5:5
  |
5 |     assert_eq!(vec![1, 2, 3,].len(), 3);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: expands to `assert_eq! { vec ! [ 1 , 2 , 3 , ] . len (  ) , 3 }`
  = note: expands to `panic! { "assertion failed: `(left == right)` \
                                     (left: `{:?}`, right: `{:?}`)"
          , left_val , right_val }`

note: trace_macro
 --> <anon>:5:16
  |
5 |     assert_eq!(vec![1, 2, 3,].len(), 3);
  |                ^^^^^^^^^^^^^^
  |
  = note: expands to `vec! { 1 , 2 , 3 , }`
  = note: expands to `vec! { 1 , 2 , 3 }`

The first message here is inaccurate. The assert_eq! macro-use does not expand to that panic! macro-use.

trace_macros shows the input to macros, not the output. So instead of "expands to:", it should say "expanding:". But changing the behavior to match what the message says would be even better. ;)

This is a regression because the error messages are new. trace_macros used to just dump token streams to stdout (lol).

@estebank
Copy link
Contributor

Introduced in #41520.

jorendorff added a commit to jorendorff/rust that referenced this issue May 19, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 23, 2017
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`.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 23, 2017
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`.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 26, 2017
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`.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 27, 2017
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`.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 27, 2017
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`.
bors added a commit that referenced this issue May 27, 2017
trace_macro: Show both the macro call and its expansion. #42072.

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`.
@Mark-Simulacrum
Copy link
Member

Closing -- I believe #42103 fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants