Skip to content

Commit

Permalink
add safety comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yuchen Liang <[email protected]>
  • Loading branch information
yliang412 committed Sep 29, 2024
1 parent 1b7991e commit 382fa0f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pageserver/src/virtual_file/dio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ impl IoBufferMut {

pub fn leak<'a>(self) -> &'a mut [u8] {
let mut buf = ManuallyDrop::new(self);
// SAFETY: leaking the buffer as intended.
unsafe { slice::from_raw_parts_mut(buf.as_mut_ptr(), buf.len) }
}
}
Expand Down

0 comments on commit 382fa0f

Please sign in to comment.