diff --git a/rust-version b/rust-version index 9b74f391bc..ebcec429d1 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -3bc9dd0dd293ab82945e35888ed6d7ab802761ef +3227e35765bab6d02c581928e26ad1d34bacf394 diff --git a/src/machine.rs b/src/machine.rs index 90e3d06aba..62c1a93079 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -123,13 +123,17 @@ impl fmt::Display for MiriMemoryKind { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Tag { pub alloc_id: AllocId, - // Stacked Borrows tag. + /// Stacked Borrows tag. pub sb: SbTag, } impl Provenance for Tag { + /// We use absolute addresses in the `offset` of a `Pointer`. 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, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (tag, addr) = ptr.into_parts(); // address is absolute write!(f, "0x{:x}", addr.bytes())?; diff --git a/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_uninit.rs b/tests/compile-fail/pointer_partial_overwrite.rs similarity index 82% rename from tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_uninit.rs rename to tests/compile-fail/pointer_partial_overwrite.rs index 3eab4c0f3d..8bee58d20a 100644 --- a/tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_uninit.rs +++ b/tests/compile-fail/pointer_partial_overwrite.rs @@ -1,6 +1,9 @@ // Make sure we find these even with many checks disabled. // compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation +// Test what happens when we overwrite parts of a pointer. +// Also see . + fn main() { let mut p = &42; unsafe { diff --git a/tests/compile-fail/pointer_byte_read.rs b/tests/compile-fail/pointer_partial_read.rs similarity index 67% rename from tests/compile-fail/pointer_byte_read.rs rename to tests/compile-fail/pointer_partial_read.rs index dcb0fd3fb9..a4a5071f5d 100644 --- a/tests/compile-fail/pointer_byte_read.rs +++ b/tests/compile-fail/pointer_partial_read.rs @@ -1,3 +1,5 @@ +// Test what happens when we read parts of a pointer. +// Related to . fn main() { let x = 13; let y = &x;