From 9304126be5633d4e7d384a8df87f5833a7a145e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=82=B3=E6=9D=83?= <695601626@qq.com> Date: Thu, 11 Apr 2024 06:08:23 +0800 Subject: chore: update to Rust 1.77.2 (#23262) update to Rust 1.77.2 --------- Co-authored-by: Matt Mastracci --- ext/ffi/callback.rs | 2 +- ext/ffi/dlfcn.rs | 2 +- ext/http/http_next.rs | 25 +------------------------ ext/http/service.rs | 2 +- ext/napi/lib.rs | 2 +- ext/node/ops/vm_internal.rs | 4 +--- ext/web/stream_resource.rs | 2 +- 7 files changed, 7 insertions(+), 32 deletions(-) (limited to 'ext') diff --git a/ext/ffi/callback.rs b/ext/ffi/callback.rs index 556d21525..eeea49c23 100644 --- a/ext/ffi/callback.rs +++ b/ext/ffi/callback.rs @@ -34,7 +34,7 @@ use std::task::Poll; static THREAD_ID_COUNTER: AtomicU32 = AtomicU32::new(1); thread_local! { - static LOCAL_THREAD_ID: RefCell = RefCell::new(0); + static LOCAL_THREAD_ID: RefCell = const { RefCell::new(0) }; } #[derive(Clone)] diff --git a/ext/ffi/dlfcn.rs b/ext/ffi/dlfcn.rs index ad287b9d0..bd46f14b2 100644 --- a/ext/ffi/dlfcn.rs +++ b/ext/ffi/dlfcn.rs @@ -101,7 +101,7 @@ struct ForeignStatic { #[derive(Debug)] enum ForeignSymbol { ForeignFunction(ForeignFunction), - ForeignStatic(ForeignStatic), + ForeignStatic(#[allow(dead_code)] ForeignStatic), } impl<'de> Deserialize<'de> for ForeignSymbol { diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs index 99d602fcc..a6527397f 100644 --- a/ext/http/http_next.rs +++ b/ext/http/http_next.rs @@ -20,6 +20,7 @@ use crate::websocket_upgrade::WebSocketUpgrade; use crate::LocalExecutor; use cache_control::CacheControl; use deno_core::error::AnyError; +use deno_core::external; use deno_core::futures::future::poll_fn; use deno_core::futures::TryFutureExt; use deno_core::op2; @@ -130,30 +131,6 @@ impl< #[repr(transparent)] struct RcHttpRecord(Rc); -// Temp copy -/// Define an external type. -macro_rules! external { - ($type:ident, $name:literal) => { - impl deno_core::Externalizable for $type { - fn external_marker() -> usize { - // Use the address of a static mut as a way to get around lack of usize-sized TypeId. Because it is mutable, the - // compiler cannot collapse multiple definitions into one. - static mut DEFINITION: deno_core::ExternalDefinition = - deno_core::ExternalDefinition::new($name); - // Wash the pointer through black_box so the compiler cannot see what we're going to do with it and needs - // to assume it will be used for valid purposes. - // SAFETY: temporary while waiting on deno core bump - let ptr = std::hint::black_box(unsafe { &mut DEFINITION } as *mut _); - ptr as usize - } - - fn external_name() -> &'static str { - $name - } - } - }; -} - // Register the [`HttpRecord`] as an external. external!(RcHttpRecord, "http record"); diff --git a/ext/http/service.rs b/ext/http/service.rs index 654da25b3..932575e37 100644 --- a/ext/http/service.rs +++ b/ext/http/service.rs @@ -150,7 +150,7 @@ impl std::ops::Deref for HttpServerState { enum RequestBodyState { Incoming(Incoming), - Resource(HttpRequestBodyAutocloser), + Resource(#[allow(dead_code)] HttpRequestBodyAutocloser), } impl From for RequestBodyState { diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs index 520597891..b3313f0fe 100644 --- a/ext/napi/lib.rs +++ b/ext/napi/lib.rs @@ -79,7 +79,7 @@ pub const napi_would_deadlock: napi_status = 21; pub const NAPI_AUTO_LENGTH: usize = usize::MAX; thread_local! { - pub static MODULE_TO_REGISTER: RefCell> = RefCell::new(None); + pub static MODULE_TO_REGISTER: RefCell> = const { RefCell::new(None) }; } type napi_addon_register_func = diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs index 274fac91a..b4bef5adb 100644 --- a/ext/node/ops/vm_internal.rs +++ b/ext/node/ops/vm_internal.rs @@ -155,9 +155,7 @@ impl ContextifyContext { scope: &mut v8::HandleScope<'a>, object: v8::Local<'a, v8::Object>, ) -> Option<&'c ContextifyContext> { - let Some(context) = object.get_creation_context(scope) else { - return None; - }; + let context = object.get_creation_context(scope)?; let context_ptr = context.get_aligned_pointer_from_embedder_data(0); // SAFETY: We are storing a pointer to the ContextifyContext diff --git a/ext/web/stream_resource.rs b/ext/web/stream_resource.rs index 9a46b6d47..b96ac36bc 100644 --- a/ext/web/stream_resource.rs +++ b/ext/web/stream_resource.rs @@ -594,7 +594,7 @@ mod tests { static V8_GLOBAL: OnceLock<()> = OnceLock::new(); thread_local! { - static ISOLATE: OnceCell> = OnceCell::new(); + static ISOLATE: OnceCell> = const { OnceCell::new() }; } fn with_isolate(mut f: impl FnMut(&mut v8::Isolate) -> T) -> T { -- cgit v1.2.3