From 6b0dcdb4404e4f6398e17c5165b99a5b7cf315d7 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 2 Mar 2022 17:30:58 +0530 Subject: [PATCH] chore: upgrade Rust to 1.59.0 (#909) --- .github/workflows/ci.yml | 2 +- rust-toolchain | 2 +- src/isolate.rs | 2 +- src/template.rs | 2 +- src/value_deserializer.rs | 8 ++------ src/value_serializer.rs | 8 ++------ .../handle_scope_escape_to_nowhere.stderr | 14 ++++++-------- tests/test_api.rs | 4 +++- 8 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d83cb34..6374e32b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: uses: hecrj/setup-rust-action@v1 with: components: clippy, rustfmt - rust-version: 1.57.0 + rust-version: 1.59.0 - name: Install python uses: actions/setup-python@v2 diff --git a/rust-toolchain b/rust-toolchain index 373aea97..bb120e87 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.57.0 +1.59.0 diff --git a/src/isolate.rs b/src/isolate.rs index 1a62f531..5172ad03 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -371,7 +371,7 @@ impl Isolate { fn get_annex_arc(&self) -> Arc { let annex_ptr = self.get_annex(); let annex_arc = unsafe { Arc::from_raw(annex_ptr) }; - Arc::into_raw(annex_arc.clone()); + let _ = Arc::into_raw(annex_arc.clone()); annex_arc } diff --git a/src/template.rs b/src/template.rs index e24a100c..71fbaebd 100644 --- a/src/template.rs +++ b/src/template.rs @@ -324,7 +324,7 @@ impl ObjectTemplate { setter: Option>, attr: PropertyAttribute, ) { - assert!(!getter.is_none() || !setter.is_none()); + assert!(getter.is_some() || setter.is_some()); unsafe { let getter = getter.map_or_else(std::ptr::null, |v| &*v); diff --git a/src/value_deserializer.rs b/src/value_deserializer.rs index dac5d469..aa9dc034 100644 --- a/src/value_deserializer.rs +++ b/src/value_deserializer.rs @@ -368,14 +368,10 @@ impl<'a, 's> ValueDeserializer<'a, 's> { let mut value_deserializer_heap = Box::pin(ValueDeserializerHeap { value_deserializer_impl, cxx_value_deserializer: CxxValueDeserializer { - _cxx_vtable: CxxVTable { - 0: std::ptr::null(), - }, + _cxx_vtable: CxxVTable(std::ptr::null()), }, cxx_value_deserializer_delegate: CxxValueDeserializerDelegate { - _cxx_vtable: CxxVTable { - 0: std::ptr::null(), - }, + _cxx_vtable: CxxVTable(std::ptr::null()), }, context: scope.get_current_context(), }); diff --git a/src/value_serializer.rs b/src/value_serializer.rs index 65c229e2..9d6b866d 100644 --- a/src/value_serializer.rs +++ b/src/value_serializer.rs @@ -410,14 +410,10 @@ impl<'a, 's> ValueSerializer<'a, 's> { let mut value_serializer_heap = Box::pin(ValueSerializerHeap { value_serializer_impl, cxx_value_serializer: CxxValueSerializer { - _cxx_vtable: CxxVTable { - 0: std::ptr::null(), - }, + _cxx_vtable: CxxVTable(std::ptr::null()), }, cxx_value_serializer_delegate: CxxValueSerializerDelegate { - _cxx_vtable: CxxVTable { - 0: std::ptr::null(), - }, + _cxx_vtable: CxxVTable(std::ptr::null()), }, buffer_size: 0, context: scope.get_current_context(), diff --git a/tests/compile_fail/handle_scope_escape_to_nowhere.stderr b/tests/compile_fail/handle_scope_escape_to_nowhere.stderr index acdf56c5..416f9f65 100644 --- a/tests/compile_fail/handle_scope_escape_to_nowhere.stderr +++ b/tests/compile_fail/handle_scope_escape_to_nowhere.stderr @@ -1,21 +1,19 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied - --> $DIR/handle_scope_escape_to_nowhere.rs:5:50 + --> tests/compile_fail/handle_scope_escape_to_nowhere.rs:5:50 | 5 | let mut _scope = v8::EscapableHandleScope::new(&mut isolate); | ----------------------------- ^^^^^^^^^^^^ the trait `v8::scope::param::NewEscapableHandleScope<'_, '_>` is not implemented for `OwnedIsolate` | | | required by a bound introduced by this call | -note: required by `EscapableHandleScope::<'s, 'e>::new` - --> $DIR/scope.rs:303:3 +note: required by a bound in `EscapableHandleScope::<'s, 'e>::new` + --> src/scope.rs | -303 | / pub fn new>( -304 | | param: &'s mut P, -305 | | ) -> P::NewScope { - | |__________________^ + | pub fn new>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EscapableHandleScope::<'s, 'e>::new` error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied - --> $DIR/handle_scope_escape_to_nowhere.rs:5:20 + --> tests/compile_fail/handle_scope_escape_to_nowhere.rs:5:20 | 5 | let mut _scope = v8::EscapableHandleScope::new(&mut isolate); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `v8::scope::param::NewEscapableHandleScope<'_, '_>` is not implemented for `OwnedIsolate` diff --git a/tests/test_api.rs b/tests/test_api.rs index bb71a1bf..836d1fad 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -8,6 +8,7 @@ use std::convert::{Into, TryFrom, TryInto}; use std::ffi::c_void; use std::ffi::CStr; use std::hash::Hash; +use std::mem::MaybeUninit; use std::os::raw::c_char; use std::ptr::NonNull; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -156,6 +157,7 @@ fn global_handle_drop() { let _setup_guard = setup(); // Global 'g1' will be dropped _after_ the Isolate has been disposed. + #[allow(clippy::needless_late_init)] let _g1: v8::Global; let isolate = &mut v8::Isolate::new(Default::default()); @@ -5239,7 +5241,7 @@ fn run_with_rust_allocator() { n: usize, ) -> *mut c_void { count.fetch_add(n, Ordering::SeqCst); - let mut store = Vec::with_capacity(n); + let mut store: Vec> = Vec::with_capacity(n); store.set_len(n); Box::into_raw(store.into_boxed_slice()) as *mut [u8] as *mut c_void }