Skip to content

Commit

Permalink
fuse: remove dependency on unstable maybe_uninit_write_slice
Browse files Browse the repository at this point in the history
  • Loading branch information
cagatay-y committed Feb 15, 2024
1 parent 93fc6cb commit bd900cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/fs/fuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,9 @@ where
{
fn from_array(nodeid: u64, op_header: O::InStruct, data: &[u8]) -> Box<Cmd<O>> {
let mut cmd = Self::with_capacity(nodeid, op_header, data.len());
MaybeUninit::write_slice(&mut cmd.payload, data);
for (target, source) in cmd.payload.iter_mut().zip(data) {
*target = MaybeUninit::new(*source);
}
unsafe { core::intrinsics::transmute(cmd) }
}
}
Expand All @@ -525,7 +527,9 @@ where
let str_bytes = str.as_bytes();
// Plus one for the NUL terminator
let mut cmd = Self::with_capacity(nodeid, op_header, str_bytes.len() + 1);
MaybeUninit::write_slice(&mut cmd.payload[..str_bytes.len()], str_bytes);
for (target, source) in cmd.payload[..str_bytes.len()].iter_mut().zip(str_bytes) {
*target = MaybeUninit::new(*source);
}
cmd.payload[str_bytes.len()] = MaybeUninit::new(b'\0');
unsafe { core::intrinsics::transmute(cmd) }
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#![feature(exposed_provenance)]
#![feature(linked_list_cursors)]
#![feature(maybe_uninit_slice)]
#![feature(maybe_uninit_write_slice)]
#![feature(naked_functions)]
#![feature(new_uninit)]
#![feature(noop_waker)]
Expand Down

0 comments on commit bd900cd

Please sign in to comment.