From a4b966a07ff6d5c20affaa7d143d939a680d7846 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 11 Dec 2022 23:04:03 +0100 Subject: [PATCH] add provenance-related test --- src/tools/miri/tests/pass/provenance.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tools/miri/tests/pass/provenance.rs b/src/tools/miri/tests/pass/provenance.rs index b18d903e36ceb..c411f748a0602 100644 --- a/src/tools/miri/tests/pass/provenance.rs +++ b/src/tools/miri/tests/pass/provenance.rs @@ -10,6 +10,7 @@ fn main() { bytewise_ptr_methods(); bytewise_custom_memcpy(); bytewise_custom_memcpy_chunked(); + int_load_strip_provenance(); } /// Some basic smoke tests for provenance. @@ -137,3 +138,9 @@ fn bytewise_custom_memcpy_chunked() { assert_eq!(*ptr, 42); } } + +fn int_load_strip_provenance() { + let ptrs = [&42]; + let ints: [usize; 1] = unsafe { mem::transmute(ptrs) }; + assert_eq!(ptrs[0] as *const _ as usize, ints[0]); +}