mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 19:33:16 +00:00
Rollup merge of #88507 - atsuzaki:slice-fill-maybeuninit-test, r=RalfJung
Add test case for using `slice::fill` with MaybeUninit Adds test for #87891 Looks alright? `@RalfJung` Fixes #87891
This commit is contained in:
commit
80b572b5e5
@ -1,5 +1,6 @@
|
||||
use core::cell::Cell;
|
||||
use core::cmp::Ordering;
|
||||
use core::mem::MaybeUninit;
|
||||
use core::result::Result::{Err, Ok};
|
||||
|
||||
#[test]
|
||||
@ -2144,3 +2145,10 @@ fn test_slice_run_destructors() {
|
||||
|
||||
assert_eq!(x.get(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_slice_fill_with_uninit() {
|
||||
// This should not UB. See #87891
|
||||
let mut a = [MaybeUninit::<u8>::uninit(); 10];
|
||||
a.fill(MaybeUninit::uninit());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user