Skip to content

Commit

Permalink
Auto merge of rust-lang#1601 - RalfJung:misc, r=RalfJung
Browse files Browse the repository at this point in the history
pointer tag tracking: also show when tag is being created

Also use bash to make sure `&>` works.
  • Loading branch information
bors committed Oct 27, 2020
2 parents 88da675 + 086e9c4 commit 5fdea5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion miri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
USAGE=$(cat <<"EOF"
COMMANDS
Expand Down
4 changes: 4 additions & 0 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cell::RefCell;
use std::fmt;
use std::num::NonZeroU64;

use log::trace;

Expand Down Expand Up @@ -41,6 +42,7 @@ impl MachineStopType for TerminationInfo {}

/// Miri specific diagnostics
pub enum NonHaltingDiagnostic {
CreatedPointerTag(NonZeroU64),
PoppedPointerTag(Item),
CreatedCallId(CallId),
CreatedAlloc(AllocId),
Expand Down Expand Up @@ -266,6 +268,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, '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) =>
Expand Down
3 changes: 3 additions & 0 deletions src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ impl GlobalState {

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
}
Expand Down

0 comments on commit 5fdea5b

Please sign in to comment.