File tree 1 file changed +19
-0
lines changed
compiler/rustc_const_eval/src/interpret
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,22 @@ pub(crate) fn create_static_alloc<'tcx>(
45
45
assert ! ( ecx. memory. alloc_map. insert( alloc_id, ( MemoryKind :: Stack , alloc) ) . is_none( ) ) ;
46
46
interp_ok ( ecx. ptr_to_mplace ( Pointer :: from ( alloc_id) . into ( ) , layout) )
47
47
}
48
+
49
+ /// This struct is needed to enforce `#[must_use]` on [tracing::span::EnteredSpan]
50
+ /// while wrapping them in an `Option`.
51
+ #[ must_use]
52
+ pub enum MaybeEnteredSpan {
53
+ Some ( tracing:: span:: EnteredSpan ) ,
54
+ None ,
55
+ }
56
+
57
+ #[ macro_export]
58
+ macro_rules! enter_trace_span {
59
+ ( $machine: ident, $( $tt: tt) * ) => {
60
+ if $machine:: TRACING_ENABLED {
61
+ $crate:: interpret:: tracing_utils:: MaybeEnteredSpan :: Some ( tracing:: info_span!( $( $tt) * ) . entered( ) )
62
+ } else {
63
+ $crate:: interpret:: tracing_utils:: MaybeEnteredSpan :: None
64
+ }
65
+ }
66
+ }
You can’t perform that action at this time.
0 commit comments