Skip to content

Commit

Permalink
add provenance-related test
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 11, 2022
1 parent f2ae9e5 commit a4b966a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tools/miri/tests/pass/provenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]);
}

0 comments on commit a4b966a

Please sign in to comment.