Skip to content

Commit 80d5ffb

Browse files
authored
chore: update to Rust 1.76 (#22376)
Update to Rust 1.76
1 parent 26d9b2f commit 80d5ffb

File tree

4 files changed

+6
-23
lines changed

4 files changed

+6
-23
lines changed

cli/napi/util.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2-
32
use deno_runtime::deno_napi::*;
4-
use std::cell::Cell;
5-
6-
unsafe fn get_backing_store_slice(
7-
backing_store: &mut v8::SharedRef<v8::BackingStore>,
8-
byte_offset: usize,
9-
byte_length: usize,
10-
) -> &mut [u8] {
11-
let cells: *const [Cell<u8>] =
12-
&backing_store[byte_offset..byte_offset + byte_length];
13-
let mut bytes = cells as *mut [u8];
14-
&mut *bytes
15-
}
163

174
pub fn get_array_buffer_ptr(ab: v8::Local<v8::ArrayBuffer>) -> *mut u8 {
18-
let mut backing_store = ab.get_backing_store();
19-
let byte_length = ab.byte_length();
20-
let mut slice =
21-
unsafe { get_backing_store_slice(&mut backing_store, 0, byte_length) };
22-
slice.as_mut_ptr()
5+
// SAFETY: Thanks to the null pointer optimization, NonNull<T> and Option<NonNull<T>> are guaranteed
6+
// to have the same size and alignment.
7+
unsafe { std::mem::transmute(ab.data()) }
238
}

cli/tools/info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ fn print_tree_node<TWrite: Write>(
284284
fn print_children<TWrite: Write>(
285285
writer: &mut TWrite,
286286
prefix: &str,
287-
children: &Vec<TreeNode>,
287+
children: &[TreeNode],
288288
) -> fmt::Result {
289289
const SIBLING_CONNECTOR: char = '├';
290290
const LAST_SIBLING_CONNECTOR: char = '└';

ext/cron/local.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ fn compute_next_deadline(cron_expression: &str) -> Result<u64, AnyError> {
318318
Ok(next_deadline.timestamp_millis() as u64)
319319
}
320320

321-
fn validate_backoff_schedule(
322-
backoff_schedule: &Vec<u32>,
323-
) -> Result<(), AnyError> {
321+
fn validate_backoff_schedule(backoff_schedule: &[u32]) -> Result<(), AnyError> {
324322
if backoff_schedule.len() > MAX_BACKOFF_COUNT {
325323
return Err(type_error("Invalid backoff schedule"));
326324
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.75.0"
2+
channel = "1.76.0"
33
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)