Skip to content

Commit 0876519

Browse files
committed
Auto merge of rust-lang#2726 - RalfJung:provenance-test, r=RalfJung
add provenance-related test One of the cases in rust-lang/miri#2182 actually works as intended since rust-lang#104054 (or maybe even earlier); make sure we test that.
2 parents f2ae9e5 + a4b966a commit 0876519

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/tools/miri/tests/pass/provenance.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fn main() {
1010
bytewise_ptr_methods();
1111
bytewise_custom_memcpy();
1212
bytewise_custom_memcpy_chunked();
13+
int_load_strip_provenance();
1314
}
1415

1516
/// Some basic smoke tests for provenance.
@@ -137,3 +138,9 @@ fn bytewise_custom_memcpy_chunked() {
137138
assert_eq!(*ptr, 42);
138139
}
139140
}
141+
142+
fn int_load_strip_provenance() {
143+
let ptrs = [&42];
144+
let ints: [usize; 1] = unsafe { mem::transmute(ptrs) };
145+
assert_eq!(ptrs[0] as *const _ as usize, ints[0]);
146+
}

0 commit comments

Comments
 (0)