@@ -18,8 +18,8 @@ use rustc_target::callconv::FnAbi;
18
18
19
19
use super :: {
20
20
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,
23
23
} ;
24
24
25
25
/// Data returned by [`Machine::after_stack_pop`], and consumed by
@@ -147,12 +147,6 @@ pub trait Machine<'tcx>: Sized {
147
147
/// already been checked before.
148
148
const ALL_CONSTS_ARE_PRECHECKED : bool = true ;
149
149
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
-
156
150
/// Whether memory accesses should be alignment-checked.
157
151
fn enforce_alignment ( ecx : & InterpCx < ' tcx , Self > ) -> bool ;
158
152
@@ -634,6 +628,16 @@ pub trait Machine<'tcx>: Sized {
634
628
/// Compute the value passed to the constructors of the `AllocBytes` type for
635
629
/// abstract machine allocations.
636
630
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
+ fn enter_trace_span ( _span : tracing:: Span ) -> impl EnteredTraceSpan {
639
+ ( )
640
+ }
637
641
}
638
642
639
643
/// A lot of the flexibility above is just needed for `Miri`, but all "compile-time" machines
0 commit comments