about summary refs log tree commit diff
path: root/library/coretests/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-14 11:39:33 +0200
committerGitHub <noreply@github.com>2025-08-14 11:39:33 +0200
commit4bc1eb737dc008fa503a080e7c092f2a5eb6e708 (patch)
treebbff2003958fe992c7fbae03b38ab348ca321cb9 /library/coretests/tests
parent90a5e62b877e0aa94043388f8cb4f916b138c921 (diff)
parenteb2913b01b3e423b2bcd73cc62406ffecbe59ea3 (diff)
downloadrust-4bc1eb737dc008fa503a080e7c092f2a5eb6e708.tar.gz
rust-4bc1eb737dc008fa503a080e7c092f2a5eb6e708.zip
Rollup merge of #142741 - a1phyr:fix_unsoundness, r=Mark-Simulacrum
Fix unsoundness in some tests

These tests were marked uninit bytes as initilized, which is unsound. Use initialized `MaybeUninit` instead.
Diffstat (limited to 'library/coretests/tests')
-rw-r--r--library/coretests/tests/io/borrowed_buf.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/coretests/tests/io/borrowed_buf.rs b/library/coretests/tests/io/borrowed_buf.rs
index 4074148436c..aaa98d26ff8 100644
--- a/library/coretests/tests/io/borrowed_buf.rs
+++ b/library/coretests/tests/io/borrowed_buf.rs
@@ -66,7 +66,7 @@ fn clear() {
 
 #[test]
 fn set_init() {
-    let buf: &mut [_] = &mut [MaybeUninit::uninit(); 16];
+    let buf: &mut [_] = &mut [MaybeUninit::zeroed(); 16];
     let mut rbuf: BorrowedBuf<'_> = buf.into();
 
     unsafe {
@@ -134,7 +134,7 @@ fn reborrow_written() {
 
 #[test]
 fn cursor_set_init() {
-    let buf: &mut [_] = &mut [MaybeUninit::uninit(); 16];
+    let buf: &mut [_] = &mut [MaybeUninit::zeroed(); 16];
     let mut rbuf: BorrowedBuf<'_> = buf.into();
 
     unsafe {