about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStypox <stypox@pm.me>2025-07-08 15:37:01 +0200
committerStypox <stypox@pm.me>2025-07-08 15:37:01 +0200
commite5f7d4d783c1567ddc16e02091bae8bacfca1418 (patch)
treeb10aeb30efdc521e5ae881197de3041bb54d9942
parente8c8330ba1a0fb7dcf8e74a8758569ab71261ef7 (diff)
downloadrust-e5f7d4d783c1567ddc16e02091bae8bacfca1418.tar.gz
rust-e5f7d4d783c1567ddc16e02091bae8bacfca1418.zip
Implement enter_trace_span() in MiriMachine
-rw-r--r--src/tools/miri/src/machine.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs
index 693b8916d89..35399dbf4cb 100644
--- a/src/tools/miri/src/machine.rs
+++ b/src/tools/miri/src/machine.rs
@@ -1014,8 +1014,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
 
     const PANIC_ON_ALLOC_FAIL: bool = false;
 
-    const TRACING_ENABLED: bool = cfg!(feature = "tracing");
-
     #[inline(always)]
     fn enforce_alignment(ecx: &MiriInterpCx<'tcx>) -> bool {
         ecx.machine.check_alignment != AlignmentCheck::None
@@ -1827,6 +1825,16 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
         #[cfg(not(target_os = "linux"))]
         MiriAllocParams::Global
     }
+
+    fn enter_trace_span(span: impl FnOnce() -> tracing::Span) -> impl EnteredTraceSpan {
+        #[cfg(feature = "tracing")]
+        { span().entered() }
+        #[cfg(not(feature = "tracing"))]
+        {
+            let _ = span; // so we avoid the "unused variable" warning
+            ()
+        }
+    }
 }
 
 /// Trait for callbacks handling asynchronous machine operations.