]> git.lizzy.rs Git - rust.git/commitdiff
pointer tag tracking: also show when tag is being created
authorRalf Jung <post@ralfj.de>
Tue, 27 Oct 2020 13:22:29 +0000 (14:22 +0100)
committerRalf Jung <post@ralfj.de>
Tue, 27 Oct 2020 13:22:29 +0000 (14:22 +0100)
src/diagnostics.rs
src/stacked_borrows.rs

index 81cd04921722762288be962f5a0ab1ca57cd4d57..12ad93a5289ee7524f4c4b19f779a5078dbde312 100644 (file)
@@ -1,5 +1,6 @@
 use std::cell::RefCell;
 use std::fmt;
+use std::num::NonZeroU64;
 
 use log::trace;
 
@@ -41,6 +42,7 @@ impl MachineStopType for TerminationInfo {}
 
 /// Miri specific diagnostics
 pub enum NonHaltingDiagnostic {
+    CreatedPointerTag(NonZeroU64),
     PoppedPointerTag(Item),
     CreatedCallId(CallId),
     CreatedAlloc(AllocId),
@@ -266,6 +268,8 @@ fn process_diagnostics(&self, info: TopFrameInfo<'tcx>) {
             for e in diagnostics.drain(..) {
                 use NonHaltingDiagnostic::*;
                 let msg = match e {
+                    CreatedPointerTag(tag) =>
+                        format!("created tag {:?}", tag),
                     PoppedPointerTag(item) =>
                         format!("popped tracked tag for item {:?}", item),
                     CreatedCallId(id) =>
index 817ed99d2bb274ff640283b44cc3014a2421fe61..257208056d76486a4f8cb426b541b9bc4b275af3 100644 (file)
@@ -168,6 +168,9 @@ pub fn new(tracked_pointer_tag: Option<PtrId>, tracked_call_id: Option<CallId>)
 
     fn new_ptr(&mut self) -> PtrId {
         let id = self.next_ptr_id;
+        if Some(id) == self.tracked_pointer_tag {
+            register_diagnostic(NonHaltingDiagnostic::CreatedPointerTag(id));
+        }
         self.next_ptr_id = NonZeroU64::new(id.get() + 1).unwrap();
         id
     }