Skip to content

Commit f6937e4

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

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/pass/provenance.rs

+7
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)