]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #84052 - RalfJung:libcore-miri, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Sat, 10 Apr 2021 16:23:35 +0000 (16:23 +0000)
committerbors <bors@rust-lang.org>
Sat, 10 Apr 2021 16:23:35 +0000 (16:23 +0000)
commit72c63de2ccf8445bfe27dcfb4f712bc771da1b15
tree9ea548441ab9dd61eccf713ffc218535c62dd184
parent4029d4d0be03b10edccb65588b522ad541b5ccaf
parentb35ac6949f341d072e45c3bf156c591613e5d928
Auto merge of #84052 - RalfJung:libcore-miri, r=Mark-Simulacrum

fix Miri errors in libcore doctests

Now that Miri can run doctests, it found some issues in the libcore doctests:
* The `AtomicPtr` tests accessed dangling memory! `AtomicPtr::new(&mut 10);` makes the `10` a temporary that is deallocated after the end of this expression.
* The tests for `set_ptr_value` used `&array[0] as *const _` to get a pointer to the array; this needs to be `array.as_ptr()` instead (Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134).
* I reduced a buffer size in a `MaybeUninit` test to make it less slow in Miri, and added a spin loop hint to fix a diverging loop in Miri.