summaryrefslogtreecommitdiff
path: root/ext/webgpu/src/buffer.rs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2022-06-26 00:13:24 +0200
committerGitHub <noreply@github.com>2022-06-26 00:13:24 +0200
commit8d82ba729937baf83011354242cabc3d50c13dc2 (patch)
tree3e8c4d87986338639eeef4a76543e4335020262c /ext/webgpu/src/buffer.rs
parent38505db39137f33bfdb942658ea892a617ac0980 (diff)
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'ext/webgpu/src/buffer.rs')
-rw-r--r--ext/webgpu/src/buffer.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/webgpu/src/buffer.rs b/ext/webgpu/src/buffer.rs
index 24bd98efb..f8bc213a3 100644
--- a/ext/webgpu/src/buffer.rs
+++ b/ext/webgpu/src/buffer.rs
@@ -105,6 +105,8 @@ pub async fn op_webgpu_buffer_get_map_async(
user_data: *mut u8,
) {
let sender_ptr = user_data as *mut oneshot::Sender<Result<(), AnyError>>;
+ // TODO(bartlomieju):
+ #[allow(clippy::undocumented_unsafe_blocks)]
let boxed_sender = unsafe { Box::from_raw(sender_ptr) };
boxed_sender
.send(match status {
@@ -188,6 +190,8 @@ pub fn op_webgpu_buffer_get_mapped_range(
))
.map_err(|e| DomExceptionOperationError::new(&e.to_string()))?;
+ // TODO(bartlomieju):
+ #[allow(clippy::undocumented_unsafe_blocks)]
let slice = unsafe {
std::slice::from_raw_parts_mut(slice_pointer, range_size as usize)
};
@@ -225,6 +229,8 @@ pub fn op_webgpu_buffer_unmap(
let size = mapped_resource.1;
if let Some(buffer) = zero_copy {
+ // TODO(bartlomieju):
+ #[allow(clippy::undocumented_unsafe_blocks)]
let slice = unsafe { std::slice::from_raw_parts_mut(slice_pointer, size) };
slice.copy_from_slice(&buffer);
}