diff --git a/src/lib.rs b/src/lib.rs
index b397e9a6d22..5a3e1c7cab0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -48,7 +48,7 @@ use mono_hash_map::MonoHashMap;
use stacked_borrows::{EvalContextExt as StackedBorEvalContextExt};
// Used by priroda
-pub use stacked_borrows::{Borrow, Stacks, Mut as MutBorrow};
+pub use stacked_borrows::{Borrow, Stack, Stacks, Mut as MutBorrow, BorStackItem};
/// Insert rustc arguments at the beginning of the argument listthat miri wants to be
/// set per default, for maximal validation power.
diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs
index dcb284b1bc3..d520c6ff5d4 100644
--- a/src/stacked_borrows.rs
+++ b/src/stacked_borrows.rs
@@ -64,6 +64,12 @@ impl Borrow {
}
}
+impl Default for Borrow {
+ fn default() -> Self {
+ Borrow::Mut(Mut::Raw)
+ }
+}
+
/// An item in the borrow stack
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum BorStackItem {
@@ -74,26 +80,33 @@ pub enum BorStackItem {
FnBarrier(usize)
}
-impl Default for Borrow {
- fn default() -> Self {
- Borrow::Mut(Mut::Raw)
+impl BorStackItem {
+ #[inline(always)]
+ pub fn is_fn_barrier(self) -> bool {
+ match self {
+ BorStackItem::FnBarrier(_) => true,
+ _ => false,
+ }
}
}
-/// What kind of reference are we talking about?
+/// What kind of usage of the pointer are we talking about?
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
-pub enum RefKind {
- Mut,
- Shr,
+pub enum UsageKind {
+ /// Write, or create &mut
+ Write,
+ /// Read, or create &
+ Read,
+ /// Create *
Raw,
}
-impl From