pub enum MiriMemoryKind {
/// `__rust_alloc` memory.
Rust,
+ /// `miri_alloc` memory.
+ Miri,
/// `malloc` memory.
C,
/// Windows `HeapAlloc` memory.
fn may_leak(self) -> bool {
use self::MiriMemoryKind::*;
match self {
- Rust | C | WinHeap | Runtime => false,
+ Rust | Miri | C | WinHeap | Runtime => false,
Machine | Global | ExternStatic | Tls => true,
}
}
use self::MiriMemoryKind::*;
match self {
Rust => write!(f, "Rust heap"),
+ Miri => write!(f, "Miri bare-metal heap"),
C => write!(f, "C heap"),
WinHeap => write!(f, "Windows heap"),
Machine => write!(f, "machine-managed memory"),
}
/// Pointer provenance.
-#[derive(Debug, Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum Provenance {
Concrete {
alloc_id: AllocId,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Scalar<Provenance>, 32);
-impl interpret::Provenance for Provenance {
- /// We use absolute addresses in the `offset` of a `Pointer<Provenance>`.
- const OFFSET_IS_ADDR: bool = true;
-
- /// We cannot err on partial overwrites, it happens too often in practice (due to unions).
- const ERR_ON_PARTIAL_PTR_OVERWRITE: bool = false;
-
- fn fmt(ptr: &Pointer<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- let (prov, addr) = ptr.into_parts(); // address is absolute
- write!(f, "{:#x}", addr.bytes())?;
-
- match prov {
+impl fmt::Debug for Provenance {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
Provenance::Concrete { alloc_id, sb } => {
// Forward `alternate` flag to `alloc_id` printing.
if f.alternate() {
write!(f, "[wildcard]")?;
}
}
-
Ok(())
}
+}
+
+impl interpret::Provenance for Provenance {
+ /// We use absolute addresses in the `offset` of a `Pointer<Provenance>`.
+ const OFFSET_IS_ADDR: bool = true;
fn get_alloc_id(self) -> Option<AllocId> {
match self {