From 80d5ffbe7c4109229571bf94182cf3f40397795e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=82=B3=E6=9D=83?= <695601626@qq.com> Date: Mon, 12 Feb 2024 11:00:33 +0800 Subject: chore: update to Rust 1.76 (#22376) Update to Rust 1.76 --- cli/napi/util.rs | 21 +++------------------ cli/tools/info.rs | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) (limited to 'cli') diff --git a/cli/napi/util.rs b/cli/napi/util.rs index ac6145a8f..edf109460 100644 --- a/cli/napi/util.rs +++ b/cli/napi/util.rs @@ -1,23 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - use deno_runtime::deno_napi::*; -use std::cell::Cell; - -unsafe fn get_backing_store_slice( - backing_store: &mut v8::SharedRef, - byte_offset: usize, - byte_length: usize, -) -> &mut [u8] { - let cells: *const [Cell] = - &backing_store[byte_offset..byte_offset + byte_length]; - let mut bytes = cells as *mut [u8]; - &mut *bytes -} pub fn get_array_buffer_ptr(ab: v8::Local) -> *mut u8 { - let mut backing_store = ab.get_backing_store(); - let byte_length = ab.byte_length(); - let mut slice = - unsafe { get_backing_store_slice(&mut backing_store, 0, byte_length) }; - slice.as_mut_ptr() + // SAFETY: Thanks to the null pointer optimization, NonNull and Option> are guaranteed + // to have the same size and alignment. + unsafe { std::mem::transmute(ab.data()) } } diff --git a/cli/tools/info.rs b/cli/tools/info.rs index 30ceb98e4..dd820f24f 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -284,7 +284,7 @@ fn print_tree_node( fn print_children( writer: &mut TWrite, prefix: &str, - children: &Vec, + children: &[TreeNode], ) -> fmt::Result { const SIBLING_CONNECTOR: char = '├'; const LAST_SIBLING_CONNECTOR: char = '└'; -- cgit v1.2.3