diff options
| author | Stypox <stypox@pm.me> | 2025-07-30 17:33:28 +0200 |
|---|---|---|
| committer | Stypox <stypox@pm.me> | 2025-07-31 00:40:00 +0200 |
| commit | 8e786169e8136223f6dfac7be85aff339b4cc893 (patch) | |
| tree | e1a584aa64b1d41241fc24086ff3273205afae27 /src | |
| parent | e5e79f8bd428d0b8d26e8240d718b134ef297459 (diff) | |
| download | rust-8e786169e8136223f6dfac7be85aff339b4cc893.tar.gz rust-8e786169e8136223f6dfac7be85aff339b4cc893.zip | |
Uniform enter_trace_span! and add documentation
The macro was uniformed between rustc_const_eval and miri
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/miri/src/helpers.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index ab7e35710d3..c52796d358d 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -1257,25 +1257,11 @@ pub struct MaybeEnteredTraceSpan { /// This is like [rustc_const_eval::enter_trace_span] except that it does not depend on the /// [Machine] trait to check if tracing is enabled, because from the Miri codebase we can directly /// check whether the "tracing" feature is enabled, unlike from the rustc_const_eval codebase. -/// -/// In addition to the syntax accepted by [tracing::span!], this macro optionally allows passing -/// the span name (i.e. the first macro argument) in the form `NAME::SUBNAME` (without quotes) to -/// indicate that the span has name "NAME" (usually the name of the component) and has an additional -/// more specific name "SUBNAME" (usually the function name). The latter is passed to the [tracing] -/// infrastructure as a span field with the name "NAME". This allows not being distracted by -/// subnames when looking at the trace in <https://ui.perfetto.dev>, but when deeper introspection -/// is needed within a component, it's still possible to view the subnames directly in the UI by -/// selecting a span, clicking on the "NAME" argument on the right, and clicking on "Visualize -/// argument values". -/// ```rust -/// // for example, the first will expand to the second -/// enter_trace_span!(borrow_tracker::on_stack_pop, /* ... */) -/// enter_trace_span!("borrow_tracker", borrow_tracker = "on_stack_pop", /* ... */) -/// ``` +/// Look at [rustc_const_eval::enter_trace_span] for complete documentation, examples and tips. #[macro_export] macro_rules! enter_trace_span { ($name:ident :: $subname:ident $($tt:tt)*) => {{ - enter_trace_span!(stringify!($name), $name = %stringify!($subname) $($tt)*) + $crate::enter_trace_span!(stringify!($name), $name = %stringify!($subname) $($tt)*) }}; ($($tt:tt)*) => { |
