From 8d82ba729937baf83011354242cabc3d50c13dc2 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sun, 26 Jun 2022 00:13:24 +0200 Subject: build: require safety comments on unsafe code (#13870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartek IwaƄczuk Co-authored-by: Divy Srivastava --- ext/webgpu/src/buffer.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ext/webgpu/src') 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>; + // 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); } -- cgit v1.2.3