@@ -18,8 +18,8 @@ use rustc_target::callconv::FnAbi;
1818
1919use super :: {
2020 AllocBytes , AllocId , AllocKind , AllocRange , Allocation , CTFE_ALLOC_SALT , ConstAllocation ,
21- CtfeProvenance , FnArg , Frame , ImmTy , InterpCx , InterpResult , MPlaceTy , MemoryKind ,
22- Misalignment , OpTy , PlaceTy , Pointer , Provenance , RangeSet , interp_ok, throw_unsup,
21+ CtfeProvenance , EnteredTraceSpan , FnArg , Frame , ImmTy , InterpCx , InterpResult , MPlaceTy ,
22+ MemoryKind , Misalignment , OpTy , PlaceTy , Pointer , Provenance , RangeSet , interp_ok, throw_unsup,
2323} ;
2424
2525/// Data returned by [`Machine::after_stack_pop`], and consumed by
@@ -147,12 +147,6 @@ pub trait Machine<'tcx>: Sized {
147147 /// already been checked before.
148148 const ALL_CONSTS_ARE_PRECHECKED : bool = true ;
149149
150- /// Determines whether rustc_const_eval functions that make use of the [Machine] should make
151- /// tracing calls (to the `tracing` library). By default this is `false`, meaning the tracing
152- /// calls will supposedly be optimized out. This flag is set to `true` inside Miri, to allow
153- /// tracing the interpretation steps, among other things.
154- const TRACING_ENABLED : bool = false ;
155-
156150 /// Whether memory accesses should be alignment-checked.
157151 fn enforce_alignment ( ecx : & InterpCx < ' tcx , Self > ) -> bool ;
158152
@@ -634,6 +628,17 @@ pub trait Machine<'tcx>: Sized {
634628 /// Compute the value passed to the constructors of the `AllocBytes` type for
635629 /// abstract machine allocations.
636630 fn get_default_alloc_params ( & self ) -> <Self :: Bytes as AllocBytes >:: AllocParams ;
631+
632+ /// Allows enabling/disabling tracing calls from within `rustc_const_eval` at compile time, by
633+ /// delegating the entering of [tracing::Span]s to implementors of the [Machine] trait. The
634+ /// default implementation corresponds to tracing being disabled, meaning the tracing calls will
635+ /// supposedly be optimized out completely. To enable tracing, override this trait method and
636+ /// return `span.entered()`. Also see [crate::enter_trace_span].
637+ #[ must_use]
638+ #[ inline( always) ]
639+ fn enter_trace_span ( _span : impl FnOnce ( ) -> tracing:: Span ) -> impl EnteredTraceSpan {
640+ ( )
641+ }
637642}
638643
639644/// A lot of the flexibility above is just needed for `Miri`, but all "compile-time" machines
0 commit comments