Closed
Description
#![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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels