File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` trace_macros `
2+
3+ The tracking issue for this feature is [ #29598 ] .
4+
5+ [ #29598 ] : https://github.com/rust-lang/rust/issues/29598
6+
7+ ------------------------
8+
9+ With ` trace_macros ` you can trace the expansion of macros in your code.
10+
11+ ## Examples
12+
13+ ``` rust
14+ #![feature(trace_macros)]
15+
16+ fn main () {
17+ trace_macros! (true );
18+ println! (" Hello, Rust!" );
19+ trace_macros! (false );
20+ }
21+ ```
22+
23+ The ` cargo build ` output:
24+
25+ ``` txt
26+ note: trace_macro
27+ --> src/main.rs:5:5
28+ |
29+ 5 | println!("Hello, Rust!");
30+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
31+ |
32+ = note: expanding `println! { "Hello, Rust!" }`
33+ = note: to `print ! ( concat ! ( "Hello, Rust!" , "\n" ) )`
34+ = note: expanding `print! { concat ! ( "Hello, Rust!" , "\n" ) }`
35+ = note: to `$crate :: io :: _print ( format_args ! ( concat ! ( "Hello, Rust!" , "\n" ) )
36+ )`
37+
38+ Finished dev [unoptimized + debuginfo] target(s) in 0.60 secs
39+ ```
You can’t perform that action at this time.
0 commit comments