summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author林炳权 <695601626@qq.com>2024-02-12 11:00:33 +0800
committerGitHub <noreply@github.com>2024-02-12 03:00:33 +0000
commit80d5ffbe7c4109229571bf94182cf3f40397795e (patch)
treebc802643634c5eb974c343b2d63060fe8de2dd3c
parent26d9b2f3174030138a13bdb60c6c76a38fa0df19 (diff)
chore: update to Rust 1.76 (#22376)
Update to Rust 1.76
-rw-r--r--cli/napi/util.rs21
-rw-r--r--cli/tools/info.rs2
-rw-r--r--ext/cron/local.rs4
-rw-r--r--rust-toolchain.toml2
4 files changed, 6 insertions, 23 deletions
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<v8::BackingStore>,
- byte_offset: usize,
- byte_length: usize,
-) -> &mut [u8] {
- let cells: *const [Cell<u8>] =
- &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<v8::ArrayBuffer>) -> *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<T> and Option<NonNull<T>> 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<TWrite: Write>(
fn print_children<TWrite: Write>(
writer: &mut TWrite,
prefix: &str,
- children: &Vec<TreeNode>,
+ children: &[TreeNode],
) -> fmt::Result {
const SIBLING_CONNECTOR: char = '├';
const LAST_SIBLING_CONNECTOR: char = '└';
diff --git a/ext/cron/local.rs b/ext/cron/local.rs
index cc3f57569..31d001bc3 100644
--- a/ext/cron/local.rs
+++ b/ext/cron/local.rs
@@ -318,9 +318,7 @@ fn compute_next_deadline(cron_expression: &str) -> Result<u64, AnyError> {
Ok(next_deadline.timestamp_millis() as u64)
}
-fn validate_backoff_schedule(
- backoff_schedule: &Vec<u32>,
-) -> Result<(), AnyError> {
+fn validate_backoff_schedule(backoff_schedule: &[u32]) -> Result<(), AnyError> {
if backoff_schedule.len() > MAX_BACKOFF_COUNT {
return Err(type_error("Invalid backoff schedule"));
}
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index c1f5c7bd1..a436857e5 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
[toolchain]
-channel = "1.75.0"
+channel = "1.76.0"
components = ["rustfmt", "clippy"]