Skip to content

Commit ce25dfe

Browse files
committed
fuse: remove dependency on unstable maybe_uninit_write_slice
1 parent fba4e32 commit ce25dfe

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/fs/fuse.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,9 @@ where
512512
{
513513
fn from_array(nodeid: u64, op_header: O::InStruct, data: &[u8]) -> Box<Cmd<O>> {
514514
let mut cmd = Self::with_capacity(nodeid, op_header, data.len());
515-
MaybeUninit::write_slice(&mut cmd.payload, data);
515+
for (target, source) in cmd.payload.iter_mut().zip(data) {
516+
*target = MaybeUninit::new(*source);
517+
}
516518
unsafe { core::intrinsics::transmute(cmd) }
517519
}
518520
}
@@ -525,7 +527,9 @@ where
525527
let str_bytes = str.as_bytes();
526528
// Plus one for the NUL terminator
527529
let mut cmd = Self::with_capacity(nodeid, op_header, str_bytes.len() + 1);
528-
MaybeUninit::write_slice(&mut cmd.payload[..str_bytes.len()], str_bytes);
530+
for (target, source) in cmd.payload[..str_bytes.len()].iter_mut().zip(str_bytes) {
531+
*target = MaybeUninit::new(*source);
532+
}
529533
cmd.payload[str_bytes.len()] = MaybeUninit::new(b'\0');
530534
unsafe { core::intrinsics::transmute(cmd) }
531535
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#![feature(exposed_provenance)]
1919
#![feature(linked_list_cursors)]
2020
#![feature(maybe_uninit_slice)]
21-
#![feature(maybe_uninit_write_slice)]
2221
#![feature(naked_functions)]
2322
#![feature(new_uninit)]
2423
#![feature(noop_waker)]

0 commit comments

Comments
 (0)