0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-23 15:50:11 -05:00

chore: bump rust-toolchain (#1408)

This commit is contained in:
Matt Mastracci 2024-03-01 10:28:17 -07:00 committed by GitHub
parent 508979cbd5
commit 63eea06a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 80 additions and 96 deletions

View file

@ -67,16 +67,13 @@ jobs:
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- name: Install rust
uses: hecrj/setup-rust-action@v1
with:
components: clippy, rustfmt
rust-version: 1.66.1
uses: dsherret/rust-toolchain-file@v1
- name: Install python
uses: actions/setup-python@v4

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.71.0"
channel = "1.76.0"
components = ["rustfmt", "clippy"]

View file

@ -957,7 +957,6 @@ impl Function {
pub fn create_code_cache(&self) -> Option<UniqueRef<CachedData<'static>>> {
let code_cache =
unsafe { UniqueRef::try_from_raw(v8__Function__CreateCodeCache(self)) };
#[cfg(debug_assertions)]
if let Some(code_cache) = &code_cache {
debug_assert_eq!(
code_cache.buffer_policy(),

View file

@ -1361,6 +1361,9 @@ pub(crate) struct IsolateAnnex {
isolate_mutex: Mutex<()>,
}
unsafe impl Send for IsolateAnnex {}
unsafe impl Sync for IsolateAnnex {}
impl IsolateAnnex {
fn new(
isolate: &mut Isolate,
@ -1395,9 +1398,6 @@ impl Debug for IsolateAnnex {
#[derive(Clone, Debug)]
pub struct IsolateHandle(Arc<IsolateAnnex>);
unsafe impl Send for IsolateHandle {}
unsafe impl Sync for IsolateHandle {}
impl IsolateHandle {
// This function is marked unsafe because it must be called only with either
// IsolateAnnex::mutex locked, or from the main thread associated with the V8

View file

@ -86,7 +86,6 @@ pub mod script_compiler;
pub mod V8;
pub use array_buffer::*;
pub use bigint::*;
pub use data::*;
pub use exception::*;
pub use external_references::ExternalReference;
@ -124,13 +123,11 @@ pub use platform::new_single_threaded_default_platform;
pub use platform::new_unprotected_default_platform;
pub use platform::Platform;
pub use primitives::*;
pub use private::*;
pub use promise::{PromiseRejectEvent, PromiseRejectMessage, PromiseState};
pub use property_attribute::*;
pub use property_descriptor::*;
pub use property_filter::*;
pub use property_handler_flags::*;
pub use proxy::*;
pub use scope::AllowJavascriptExecutionScope;
pub use scope::CallbackScope;
pub use scope::ContextScope;
@ -150,7 +147,6 @@ pub use support::SharedPtr;
pub use support::SharedRef;
pub use support::UniquePtr;
pub use support::UniqueRef;
pub use symbol::*;
pub use template::*;
pub use value_deserializer::ValueDeserializer;
pub use value_deserializer::ValueDeserializerHelper;

View file

@ -287,12 +287,11 @@ impl<'s> HandleScope<'s> {
for<'l> Local<'l, Data>: TryInto<Local<'l, T>>,
{
unsafe {
let Some(res) = self
.cast_local(|sd| {
raw::v8__Isolate__GetDataFromSnapshotOnce(sd.get_isolate_ptr(), index)
}) else {
return Err(DataError::no_data::<T>());
};
let Some(res) = self.cast_local(|sd| {
raw::v8__Isolate__GetDataFromSnapshotOnce(sd.get_isolate_ptr(), index)
}) else {
return Err(DataError::no_data::<T>());
};
use get_data_sealed::ToDataError;
match res.try_into() {
Ok(x) => Ok(x),
@ -319,12 +318,14 @@ impl<'s> HandleScope<'s> {
for<'l> Local<'l, Data>: TryInto<Local<'l, T>>,
{
unsafe {
let Some(res) = self
.cast_local(|sd| {
raw::v8__Context__GetDataFromSnapshotOnce(sd.get_current_context(), index)
}) else {
return Err(DataError::no_data::<T>());
};
let Some(res) = self.cast_local(|sd| {
raw::v8__Context__GetDataFromSnapshotOnce(
sd.get_current_context(),
index,
)
}) else {
return Err(DataError::no_data::<T>());
};
use get_data_sealed::ToDataError;
match res.try_into() {
Ok(x) => Ok(x),

View file

@ -66,9 +66,9 @@ impl Drop for StartupData {
impl Deref for StartupData {
type Target = [u8];
fn deref(&self) -> &Self::Target {
let data = self.data as *const u8;
let data = self.data;
let len = usize::try_from(self.raw_size).unwrap();
unsafe { std::slice::from_raw_parts(data, len) }
unsafe { std::slice::from_raw_parts(data as _, len) }
}
}

View file

@ -514,7 +514,7 @@ impl<F> Copy for FieldOffset<F> {}
impl<F> Clone for FieldOffset<F> {
fn clone(&self) -> Self {
Self(self.0, self.1)
*self
}
}

View file

@ -17,7 +17,6 @@ impl UnboundModuleScript {
let code_cache = unsafe {
UniqueRef::try_from_raw(v8__UnboundModuleScript__CreateCodeCache(self))
};
#[cfg(debug_assertions)]
if let Some(code_cache) = &code_cache {
debug_assert_eq!(
code_cache.buffer_policy(),

View file

@ -34,7 +34,6 @@ impl UnboundScript {
let code_cache = unsafe {
UniqueRef::try_from_raw(v8__UnboundScript__CreateCodeCache(self))
};
#[cfg(debug_assertions)]
if let Some(code_cache) = &code_cache {
debug_assert_eq!(
code_cache.buffer_policy(),

View file

@ -488,11 +488,7 @@ impl<'a, 's> ValueSerializer<'a, 's> {
&mut ptr,
&mut size,
);
Vec::from_raw_parts(
ptr as *mut u8,
size,
self.value_serializer_heap.buffer_size,
)
Vec::from_raw_parts(ptr, size, self.value_serializer_heap.buffer_size)
}
}

View file

@ -159,7 +159,7 @@ impl CompiledWasmModule {
let mut len = 0;
unsafe {
let ptr = v8__CompiledWasmModule__SourceUrl(self.0, &mut len);
let bytes = std::slice::from_raw_parts(ptr as *const u8, len);
let bytes = std::slice::from_raw_parts(ptr as _, len);
std::str::from_utf8_unchecked(bytes)
}
}

View file

@ -1,24 +1,24 @@
error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied
--> 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
|
= help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`:
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<ContextScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<HandleScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<TryCatch<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
--> 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
|
= help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`:
<ContextScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<HandleScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<TryCatch<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
note: required by a bound in `EscapableHandleScope::<'s, 'e>::new`
--> src/scope.rs
|
| pub fn new<P: param::NewEscapableHandleScope<'s, 'e>>(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EscapableHandleScope::<'s, 'e>::new`
--> src/scope.rs
|
| pub fn new<P: param::NewEscapableHandleScope<'s, 'e>>(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EscapableHandleScope::<'s, 'e>::new`
error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied
--> tests/compile_fail/handle_scope_escape_to_nowhere.rs:5:20
@ -27,13 +27,13 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `v8::scope::param::NewEscapableHandleScope<'_, '_>` is not implemented for `OwnedIsolate`
|
= help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`:
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<ContextScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<HandleScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<TryCatch<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied
--> tests/compile_fail/handle_scope_escape_to_nowhere.rs:5:20
@ -42,10 +42,10 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `v8::scope::param::NewEscapableHandleScope<'_, '_>` is not implemented for `OwnedIsolate`
|
= help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`:
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<ContextScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<HandleScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<EscapableHandleScope<'p, 'e, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<TryCatch<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<CallbackScope<'p, C> as v8::scope::param::NewEscapableHandleScope<'s, 'p>>
<DisallowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>
<AllowJavascriptExecutionScope<'p, P> as v8::scope::param::NewEscapableHandleScope<'s, 'e>>

View file

@ -1,15 +1,15 @@
error[E0308]: mismatched types
--> tests/compile_fail/object_without_context_scope.rs:6:33
|
6 | let _object = v8::Object::new(&mut scope);
| --------------- ^^^^^^^^^^ expected `&mut HandleScope<'_>`, found `&mut HandleScope<'_, ()>`
| |
| arguments to this function are incorrect
|
= note: expected mutable reference `&mut HandleScope<'_>`
found mutable reference `&mut HandleScope<'_, ()>`
--> tests/compile_fail/object_without_context_scope.rs:6:33
|
6 | let _object = v8::Object::new(&mut scope);
| --------------- ^^^^^^^^^^ expected `&mut HandleScope<'_>`, found `&mut HandleScope<'_, ()>`
| |
| arguments to this function are incorrect
|
= note: expected mutable reference `&mut HandleScope<'_, v8::Context>`
found mutable reference `&mut HandleScope<'_, ()>`
note: associated function defined here
--> src/object.rs
|
| pub fn new<'s>(scope: &mut HandleScope<'s>) -> Local<'s, Object> {
| ^^^
--> src/object.rs
|
| pub fn new<'s>(scope: &mut HandleScope<'s>) -> Local<'s, Object> {
| ^^^

View file

@ -263,8 +263,7 @@ fn test_string() {
assert_eq!(15, local.length());
assert_eq!(17, local.utf8_length(scope));
assert_eq!(reference, local.to_rust_string_lossy(scope));
let mut vec = Vec::new();
vec.resize(17, 0);
let mut vec = vec![0; 17];
let options = v8::WriteOptions::NO_NULL_TERMINATION;
let mut nchars = 0;
assert_eq!(
@ -705,8 +704,8 @@ fn get_isolate_from_handle() {
let context = v8::Context::new(scope);
let scope = &mut v8::ContextScope::new(scope, context);
check_handle(scope, None, |s| v8::null(s));
check_handle(scope, None, |s| v8::undefined(s));
check_handle(scope, None, v8::null);
check_handle(scope, None, v8::undefined);
check_handle(scope, None, |s| v8::Boolean::new(s, true));
check_handle(scope, None, |s| v8::Boolean::new(s, false));
check_handle(scope, None, |s| v8::String::new(s, "").unwrap());
@ -878,13 +877,13 @@ fn array_buffer() {
data[0] = 1;
let unique_bs =
v8::ArrayBuffer::new_backing_store_from_bytes(Box::new(data));
assert_eq!(unique_bs.get(0).unwrap().get(), 1);
assert_eq!(unique_bs.first().unwrap().get(), 1);
assert_eq!(unique_bs.get(15).unwrap().get(), 100);
let ab =
v8::ArrayBuffer::with_backing_store(scope, &unique_bs.make_shared());
assert_eq!(ab.byte_length(), 16);
assert_eq!(ab.get_backing_store().get(0).unwrap().get(), 1);
assert_eq!(ab.get_backing_store().first().unwrap().get(), 1);
}
}
@ -1001,7 +1000,7 @@ fn deref_empty_backing_store() {
let backing_store = v8::ArrayBuffer::new_backing_store(isolate, 0);
let slice: &[std::cell::Cell<u8>] = &backing_store;
assert!(!slice.as_ptr().is_null());
assert!(!std::hint::black_box(slice.as_ptr()).is_null());
}
fn eval<'s>(
@ -4203,6 +4202,7 @@ fn promise_reject_callback_no_value() {
}
#[test]
#[allow(clippy::clone_on_copy)]
fn promise_hook() {
extern "C" fn hook(
type_: v8::PromiseHookType,
@ -4210,8 +4210,8 @@ fn promise_hook() {
_parent: v8::Local<v8::Value>,
) {
// Check that PromiseHookType implements Clone and PartialEq.
#[allow(clippy::clone_on_copy)]
if type_.clone() == v8::PromiseHookType::Init {}
_ = type_.clone() == v8::PromiseHookType::Init;
let scope = &mut unsafe { v8::CallbackScope::new(promise) };
let context = promise.get_creation_context(scope).unwrap();
let scope = &mut v8::ContextScope::new(scope, context);
@ -5468,8 +5468,8 @@ fn snapshot_creator_multiple_contexts() {
fn external_references() {
let _setup_guard = setup::sequential_test();
// Allocate externals for the test.
let external_ptr = Box::into_raw(vec![0_u8, 1, 2, 3, 4].into_boxed_slice())
as *mut [u8] as *mut c_void;
let external_ptr =
Box::into_raw(vec![0_u8, 1, 2, 3, 4].into_boxed_slice()) as *mut c_void;
// Push them to the external reference table.
let refs = [
v8::ExternalReference {
@ -7683,16 +7683,13 @@ fn bigint() {
let raw_b = v8::Local::<v8::BigInt>::try_from(raw_b).unwrap();
let mut vec = Vec::new();
vec.resize(raw_b.word_count(), 0);
let mut vec = vec![0; raw_b.word_count()];
assert_eq!(raw_b.to_words_array(&mut vec), (true, &mut [10, 10][..]));
let mut vec = Vec::new();
vec.resize(1, 0);
let mut vec = vec![0; 1];
assert_eq!(raw_b.to_words_array(&mut vec), (true, &mut [10][..]));
let mut vec = Vec::new();
vec.resize(20, 1337);
let mut vec = vec![1337, 20];
assert_eq!(raw_b.to_words_array(&mut vec), (true, &mut [10, 10][..]));
}
@ -8415,7 +8412,7 @@ fn run_with_rust_allocator() {
unsafe extern "C" fn allocate(count: &AtomicUsize, n: usize) -> *mut c_void {
count.fetch_add(n, Ordering::SeqCst);
Box::into_raw(vec![0u8; n].into_boxed_slice()) as *mut [u8] as *mut c_void
Box::into_raw(vec![0u8; n].into_boxed_slice()) as *mut c_void
}
unsafe extern "C" fn allocate_uninitialized(
count: &AtomicUsize,
@ -8443,7 +8440,7 @@ fn run_with_rust_allocator() {
let copy_len = oldlen.min(newlen);
new_store.extend_from_slice(&old_store[..copy_len]);
new_store.resize(newlen, 0u8);
Box::into_raw(new_store.into_boxed_slice()) as *mut [u8] as *mut c_void
Box::into_raw(new_store.into_boxed_slice()) as *mut c_void
}
unsafe extern "C" fn drop(count: *const AtomicUsize) {
Arc::from_raw(count);