Skip to content

Conversation

@stepancheg
Copy link

FuseDevWriter.buf field is ManuallyDrop<Vec<u8>>, but actually it is a pair of &mut [u8] space and position.

Express this logic more explicitly with

pub(crate) struct BytesCursor<'a> {
    slice: &'a mut [u8],
    position: usize,
}

Because:

  • less unsafe code
  • more operations are checked
  • with this change it is clear that there's no UB (for example, related to aliasing &mut pointers). It may be not an issue, but with this change is much more clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant