mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-25 16:49:29 -05:00
chore: update Rust to 1.65.0 (#1116)
This commit is contained in:
parent
f827193799
commit
65ff64e5cd
23 changed files with 140 additions and 100 deletions
4
build.rs
4
build.rs
|
@ -216,7 +216,7 @@ fn build_v8() {
|
|||
fn print_gn_args(gn_out_dir: &Path) {
|
||||
assert!(Command::new(gn())
|
||||
.arg("args")
|
||||
.arg(&gn_out_dir)
|
||||
.arg(gn_out_dir)
|
||||
.arg("--list")
|
||||
.status()
|
||||
.unwrap()
|
||||
|
@ -643,7 +643,7 @@ fn ninja(gn_out_dir: &Path, maybe_env: Option<NinjaEnv>) -> Command {
|
|||
let cmd_string = env::var("NINJA").unwrap_or_else(|_| "ninja".to_owned());
|
||||
let mut cmd = Command::new(cmd_string);
|
||||
cmd.arg("-C");
|
||||
cmd.arg(&gn_out_dir);
|
||||
cmd.arg(gn_out_dir);
|
||||
if let Some(env) = maybe_env {
|
||||
for item in env {
|
||||
cmd.env(item.0, item.1);
|
||||
|
|
|
@ -17,7 +17,7 @@ fn main() {
|
|||
let context_scope = &mut v8::ContextScope::new(handle_scope, context);
|
||||
let scope = &mut v8::HandleScope::new(context_scope);
|
||||
|
||||
run_main(scope, &*args, &mut run_shell_flag);
|
||||
run_main(scope, &args, &mut run_shell_flag);
|
||||
|
||||
if run_shell_flag {
|
||||
run_shell(scope);
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
1.60.0
|
3
rust-toolchain.toml
Normal file
3
rust-toolchain.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "1.65.0"
|
||||
components = ["rustfmt", "clippy"]
|
|
@ -85,7 +85,7 @@ impl BigInt {
|
|||
#[inline(always)]
|
||||
pub fn u64_value(&self) -> (u64, bool) {
|
||||
let mut lossless = MaybeUninit::uninit();
|
||||
let v = unsafe { v8__BigInt__Uint64Value(&*self, lossless.as_mut_ptr()) };
|
||||
let v = unsafe { v8__BigInt__Uint64Value(self, lossless.as_mut_ptr()) };
|
||||
let lossless = unsafe { lossless.assume_init() };
|
||||
(v, lossless)
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl BigInt {
|
|||
#[inline(always)]
|
||||
pub fn i64_value(&self) -> (i64, bool) {
|
||||
let mut lossless = MaybeUninit::uninit();
|
||||
let v = unsafe { v8__BigInt__Int64Value(&*self, lossless.as_mut_ptr()) };
|
||||
let v = unsafe { v8__BigInt__Int64Value(self, lossless.as_mut_ptr()) };
|
||||
let lossless = unsafe { lossless.assume_init() };
|
||||
(v, lossless)
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ impl BigInt {
|
|||
/// `to_words_array`.
|
||||
#[inline(always)]
|
||||
pub fn word_count(&self) -> usize {
|
||||
unsafe { v8__BigInt__WordCount(&*self) as usize }
|
||||
unsafe { v8__BigInt__WordCount(self) as usize }
|
||||
}
|
||||
|
||||
/// Converts this BigInt to a (sign_bit, words) pair. `sign_bit` will be true
|
||||
|
@ -119,7 +119,7 @@ impl BigInt {
|
|||
let mut word_count = words.len() as int;
|
||||
unsafe {
|
||||
v8__BigInt__ToWordsArray(
|
||||
&*self,
|
||||
self,
|
||||
sign_bit.as_mut_ptr(),
|
||||
&mut word_count,
|
||||
words.as_mut_ptr(),
|
||||
|
|
|
@ -40,12 +40,12 @@ impl ExternalReferences {
|
|||
impl std::ops::Deref for ExternalReferences {
|
||||
type Target = [intptr_t];
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&*self.null_terminated
|
||||
&self.null_terminated
|
||||
}
|
||||
}
|
||||
|
||||
impl std::borrow::Borrow<[intptr_t]> for ExternalReferences {
|
||||
fn borrow(&self) -> &[intptr_t] {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ impl CTypeInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum SequenceType {
|
||||
Scalar,
|
||||
|
|
|
@ -810,14 +810,14 @@ impl Function {
|
|||
#[inline(always)]
|
||||
pub fn get_script_column_number(&self) -> Option<u32> {
|
||||
let ret = unsafe { v8__Function__GetScriptColumnNumber(self) };
|
||||
(ret >= 0).then(|| ret as u32)
|
||||
(ret >= 0).then_some(ret as u32)
|
||||
}
|
||||
|
||||
/// Get the (zero-indexed) line number of the function's definition, if available.
|
||||
#[inline(always)]
|
||||
pub fn get_script_line_number(&self) -> Option<u32> {
|
||||
let ret = unsafe { v8__Function__GetScriptLineNumber(self) };
|
||||
(ret >= 0).then(|| ret as u32)
|
||||
(ret >= 0).then_some(ret as u32)
|
||||
}
|
||||
|
||||
/// Creates and returns code cache for the specified unbound_script.
|
||||
|
|
|
@ -350,7 +350,7 @@ impl<'a, T> Handle for &'a UnsafeRefHandle<'_, T> {
|
|||
|
||||
impl<'s, T> Borrow<T> for Local<'s, T> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ impl<T> Eq for Global<T> where T: Eq {}
|
|||
|
||||
impl<'s, T: Hash> Hash for Local<'s, T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
(&**self).hash(state)
|
||||
(**self).hash(state)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'s, T, Rhs: Handle> PartialEq<Rhs> for Global<T>
|
||||
impl<T, Rhs: Handle> PartialEq<Rhs> for Global<T>
|
||||
where
|
||||
T: PartialEq<Rhs::Data>,
|
||||
{
|
||||
|
|
|
@ -822,7 +822,7 @@ impl fmt::Display for CharacterArray<'_, u8> {
|
|||
|
||||
impl fmt::Display for CharacterArray<'_, u16> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.write_str(&string::String::from_utf16_lossy(&*self))
|
||||
f.write_str(&string::String::from_utf16_lossy(self))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ use std::sync::Mutex;
|
|||
/// Isolate::PerformMicrotaskCheckpoint() method;
|
||||
/// - auto: microtasks are invoked when the script call depth decrements
|
||||
/// to zero.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum MicrotasksPolicy {
|
||||
Explicit = 0,
|
||||
|
@ -84,7 +84,7 @@ pub enum MicrotasksPolicy {
|
|||
///
|
||||
/// PromiseHook with type After is called right at the end of the
|
||||
/// PromiseReactionJob.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum PromiseHookType {
|
||||
Init,
|
||||
|
@ -100,7 +100,7 @@ pub type PromiseHook =
|
|||
|
||||
pub type PromiseRejectCallback = extern "C" fn(PromiseRejectMessage);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum WasmAsyncSuccess {
|
||||
Success,
|
||||
|
|
|
@ -230,7 +230,7 @@ impl Location {
|
|||
/// This corresponds to the states used in ECMAScript except that "evaluated"
|
||||
/// is split into kEvaluated and kErrored, indicating success and failure,
|
||||
/// respectively.
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum ModuleStatus {
|
||||
Uninstantiated,
|
||||
|
@ -345,20 +345,20 @@ impl Module {
|
|||
) -> Option<Local<'s, Value>> {
|
||||
unsafe {
|
||||
scope
|
||||
.cast_local(|sd| v8__Module__Evaluate(&*self, sd.get_current_context()))
|
||||
.cast_local(|sd| v8__Module__Evaluate(self, sd.get_current_context()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether the module is a SourceTextModule.
|
||||
#[inline(always)]
|
||||
pub fn is_source_text_module(&self) -> bool {
|
||||
unsafe { v8__Module__IsSourceTextModule(&*self) }
|
||||
unsafe { v8__Module__IsSourceTextModule(self) }
|
||||
}
|
||||
|
||||
/// Returns whether the module is a SyntheticModule.
|
||||
#[inline(always)]
|
||||
pub fn is_synthetic_module(&self) -> bool {
|
||||
unsafe { v8__Module__IsSyntheticModule(&*self) }
|
||||
unsafe { v8__Module__IsSyntheticModule(self) }
|
||||
}
|
||||
|
||||
/// Creates a new SyntheticModule with the specified export names, where
|
||||
|
@ -406,7 +406,7 @@ impl Module {
|
|||
) -> Option<bool> {
|
||||
unsafe {
|
||||
v8__Module__SetSyntheticModuleExport(
|
||||
&*self,
|
||||
self,
|
||||
scope.get_isolate_ptr(),
|
||||
&*export_name,
|
||||
&*export_value,
|
||||
|
@ -446,7 +446,7 @@ impl Module {
|
|||
|
||||
let returned_len = unsafe {
|
||||
v8__Module__GetStalledTopLevelAwaitMessage(
|
||||
&*self,
|
||||
self,
|
||||
scope.get_isolate_ptr(),
|
||||
out_vec.as_mut_ptr(),
|
||||
out_vec.len(),
|
||||
|
|
|
@ -61,6 +61,6 @@ impl Private {
|
|||
/// Returns the print name string of the private symbol, or undefined if none.
|
||||
#[inline(always)]
|
||||
pub fn name<'s>(&self, scope: &mut HandleScope<'s, ()>) -> Local<'s, Value> {
|
||||
unsafe { scope.cast_local(|_| v8__Private__Name(&*self)) }.unwrap()
|
||||
unsafe { scope.cast_local(|_| v8__Private__Name(self)) }.unwrap()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ extern "C" {
|
|||
) -> PromiseRejectEvent;
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum PromiseState {
|
||||
Pending,
|
||||
|
@ -69,21 +69,21 @@ impl Promise {
|
|||
/// Returns the value of the [[PromiseState]] field.
|
||||
#[inline(always)]
|
||||
pub fn state(&self) -> PromiseState {
|
||||
unsafe { v8__Promise__State(&*self) }
|
||||
unsafe { v8__Promise__State(self) }
|
||||
}
|
||||
|
||||
/// Returns true if the promise has at least one derived promise, and
|
||||
/// therefore resolve/reject handlers (including default handler).
|
||||
#[inline(always)]
|
||||
pub fn has_handler(&self) -> bool {
|
||||
unsafe { v8__Promise__HasHandler(&*self) }
|
||||
unsafe { v8__Promise__HasHandler(self) }
|
||||
}
|
||||
|
||||
/// Returns the content of the [[PromiseResult]] field. The Promise must not
|
||||
/// be pending.
|
||||
#[inline(always)]
|
||||
pub fn result<'s>(&self, scope: &mut HandleScope<'s>) -> Local<'s, Value> {
|
||||
unsafe { scope.cast_local(|_| v8__Promise__Result(&*self)) }.unwrap()
|
||||
unsafe { scope.cast_local(|_| v8__Promise__Result(self)) }.unwrap()
|
||||
}
|
||||
|
||||
/// Register a rejection handler with a promise.
|
||||
|
@ -97,7 +97,7 @@ impl Promise {
|
|||
) -> Option<Local<'s, Promise>> {
|
||||
unsafe {
|
||||
scope.cast_local(|sd| {
|
||||
v8__Promise__Catch(&*self, sd.get_current_context(), &*handler)
|
||||
v8__Promise__Catch(self, sd.get_current_context(), &*handler)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ impl Promise {
|
|||
) -> Option<Local<'s, Promise>> {
|
||||
unsafe {
|
||||
scope.cast_local(|sd| {
|
||||
v8__Promise__Then(&*self, sd.get_current_context(), &*handler)
|
||||
v8__Promise__Then(self, sd.get_current_context(), &*handler)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ impl Promise {
|
|||
unsafe {
|
||||
scope.cast_local(|sd| {
|
||||
v8__Promise__Then2(
|
||||
&*self,
|
||||
self,
|
||||
sd.get_current_context(),
|
||||
&*on_fulfilled,
|
||||
&*on_rejected,
|
||||
|
@ -160,7 +160,7 @@ impl PromiseResolver {
|
|||
&self,
|
||||
scope: &mut HandleScope<'s>,
|
||||
) -> Local<'s, Promise> {
|
||||
unsafe { scope.cast_local(|_| v8__Promise__Resolver__GetPromise(&*self)) }
|
||||
unsafe { scope.cast_local(|_| v8__Promise__Resolver__GetPromise(self)) }
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ impl PromiseResolver {
|
|||
) -> Option<bool> {
|
||||
unsafe {
|
||||
v8__Promise__Resolver__Resolve(
|
||||
&*self,
|
||||
self,
|
||||
&*scope.get_current_context(),
|
||||
&*value,
|
||||
)
|
||||
|
@ -192,7 +192,7 @@ impl PromiseResolver {
|
|||
) -> Option<bool> {
|
||||
unsafe {
|
||||
v8__Promise__Resolver__Reject(
|
||||
&*self,
|
||||
self,
|
||||
&*scope.get_current_context(),
|
||||
&*value,
|
||||
)
|
||||
|
@ -201,7 +201,7 @@ impl PromiseResolver {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub enum PromiseRejectEvent {
|
||||
PromiseRejectWithNoHandler,
|
||||
|
|
|
@ -36,7 +36,7 @@ impl Proxy {
|
|||
&self,
|
||||
scope: &mut HandleScope<'s>,
|
||||
) -> Local<'s, Value> {
|
||||
unsafe { scope.cast_local(|_| v8__Proxy__GetHandler(&*self)) }.unwrap()
|
||||
unsafe { scope.cast_local(|_| v8__Proxy__GetHandler(self)) }.unwrap()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -44,7 +44,7 @@ impl Proxy {
|
|||
&self,
|
||||
scope: &mut HandleScope<'s>,
|
||||
) -> Local<'s, Value> {
|
||||
unsafe { scope.cast_local(|_| v8__Proxy__GetTarget(&*self)) }.unwrap()
|
||||
unsafe { scope.cast_local(|_| v8__Proxy__GetTarget(self)) }.unwrap()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
|
@ -78,13 +78,13 @@ impl Deref for StartupData {
|
|||
|
||||
impl AsRef<[u8]> for StartupData {
|
||||
fn as_ref(&self) -> &[u8] {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Borrow<[u8]> for StartupData {
|
||||
fn borrow(&self) -> &[u8] {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,25 +152,25 @@ impl<T: ?Sized> DerefMut for UniqueRef<T> {
|
|||
|
||||
impl<T: ?Sized> AsRef<T> for UniqueRef<T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> AsMut<T> for UniqueRef<T> {
|
||||
fn as_mut(&mut self) -> &mut T {
|
||||
&mut **self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Borrow<T> for UniqueRef<T> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> BorrowMut<T> for UniqueRef<T> {
|
||||
fn borrow_mut(&mut self) -> &mut T {
|
||||
&mut **self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,13 +324,13 @@ impl<T: Shared> Deref for SharedRef<T> {
|
|||
|
||||
impl<T: Shared> AsRef<T> for SharedRef<T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Shared> Borrow<T> for SharedRef<T> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,25 +452,25 @@ impl<T: ?Sized> Deref for Allocation<T> {
|
|||
Self::Box(v) => v.borrow(),
|
||||
Self::Rc(v) => v.borrow(),
|
||||
Self::UniqueRef(v) => v.borrow(),
|
||||
Self::Other(v) => (&**v).borrow(),
|
||||
Self::Other(v) => (**v).borrow(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> AsRef<T> for Allocation<T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Borrow<T> for Allocation<T> {
|
||||
fn borrow(&self) -> &T {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum MaybeBool {
|
||||
JustFalse = 0,
|
||||
JustTrue = 1,
|
||||
|
@ -855,7 +855,7 @@ mod tests {
|
|||
|
||||
impl Borrow<TestObj> for TestObjRef {
|
||||
fn borrow(&self) -> &TestObj {
|
||||
&**self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,7 @@ impl Symbol {
|
|||
scope: &mut HandleScope<'s, ()>,
|
||||
) -> Local<'s, Value> {
|
||||
unsafe {
|
||||
scope
|
||||
.cast_local(|sd| v8__Symbol__Description(&*self, sd.get_isolate_ptr()))
|
||||
scope.cast_local(|sd| v8__Symbol__Description(self, sd.get_isolate_ptr()))
|
||||
}
|
||||
.unwrap()
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ impl<'a, 's> ValueDeserializerHelper for ValueDeserializerHeap<'a, 's> {
|
|||
|
||||
impl<'a, 's> ValueDeserializerHelper for ValueDeserializer<'a, 's> {
|
||||
fn get_cxx_value_deserializer(&mut self) -> &mut CxxValueDeserializer {
|
||||
&mut (*self.value_deserializer_heap).cxx_value_deserializer
|
||||
&mut self.value_deserializer_heap.cxx_value_deserializer
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,18 +378,20 @@ impl<'a, 's> ValueDeserializer<'a, 's> {
|
|||
});
|
||||
|
||||
unsafe {
|
||||
v8__ValueDeserializer__Delegate__CONSTRUCT(core::mem::transmute(
|
||||
&mut (*value_deserializer_heap).cxx_value_deserializer_delegate,
|
||||
));
|
||||
v8__ValueDeserializer__Delegate__CONSTRUCT(
|
||||
&mut value_deserializer_heap.cxx_value_deserializer_delegate
|
||||
as *mut CxxValueDeserializerDelegate
|
||||
as *mut std::mem::MaybeUninit<CxxValueDeserializerDelegate>,
|
||||
);
|
||||
|
||||
v8__ValueDeserializer__CONSTRUCT(
|
||||
core::mem::transmute(
|
||||
&mut (*value_deserializer_heap).cxx_value_deserializer,
|
||||
),
|
||||
&mut value_deserializer_heap.cxx_value_deserializer
|
||||
as *mut CxxValueDeserializer
|
||||
as *mut std::mem::MaybeUninit<CxxValueDeserializer>,
|
||||
scope.get_isolate_ptr(),
|
||||
data.as_ptr(),
|
||||
data.len(),
|
||||
&mut (*value_deserializer_heap).cxx_value_deserializer_delegate,
|
||||
&mut value_deserializer_heap.cxx_value_deserializer_delegate,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -406,7 +408,7 @@ impl<'a, 's> ValueDeserializer<'a, 's> {
|
|||
) {
|
||||
unsafe {
|
||||
v8__ValueDeserializer__SetSupportsLegacyWireFormat(
|
||||
&mut (*self.value_deserializer_heap).cxx_value_deserializer,
|
||||
&mut self.value_deserializer_heap.cxx_value_deserializer,
|
||||
supports_legacy_wire_format,
|
||||
);
|
||||
}
|
||||
|
@ -416,6 +418,6 @@ impl<'a, 's> ValueDeserializer<'a, 's> {
|
|||
&mut self,
|
||||
context: Local<'t, Context>,
|
||||
) -> Option<Local<'t, Value>> {
|
||||
(*self.value_deserializer_heap).read_value(context)
|
||||
self.value_deserializer_heap.read_value(context)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ impl<'a, 's> ValueSerializerHelper for ValueSerializerHeap<'a, 's> {
|
|||
|
||||
impl<'a, 's> ValueSerializerHelper for ValueSerializer<'a, 's> {
|
||||
fn get_cxx_value_serializer(&mut self) -> &mut CxxValueSerializer {
|
||||
&mut (*self.value_serializer_heap).cxx_value_serializer
|
||||
&mut self.value_serializer_heap.cxx_value_serializer
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,16 +421,18 @@ impl<'a, 's> ValueSerializer<'a, 's> {
|
|||
});
|
||||
|
||||
unsafe {
|
||||
v8__ValueSerializer__Delegate__CONSTRUCT(core::mem::transmute(
|
||||
&mut (*value_serializer_heap).cxx_value_serializer_delegate,
|
||||
));
|
||||
v8__ValueSerializer__Delegate__CONSTRUCT(
|
||||
&mut value_serializer_heap.cxx_value_serializer_delegate
|
||||
as *mut CxxValueSerializerDelegate
|
||||
as *mut std::mem::MaybeUninit<CxxValueSerializerDelegate>,
|
||||
);
|
||||
|
||||
v8__ValueSerializer__CONSTRUCT(
|
||||
core::mem::transmute(
|
||||
&mut (*value_serializer_heap).cxx_value_serializer,
|
||||
),
|
||||
&mut value_serializer_heap.cxx_value_serializer
|
||||
as *mut CxxValueSerializer
|
||||
as *mut std::mem::MaybeUninit<CxxValueSerializer>,
|
||||
scope.get_isolate_ptr(),
|
||||
&mut (*value_serializer_heap).cxx_value_serializer_delegate,
|
||||
&mut value_serializer_heap.cxx_value_serializer_delegate,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -446,14 +448,14 @@ impl<'a, 's> ValueSerializer<'a, 's> {
|
|||
let mut size: usize = 0;
|
||||
let mut ptr: *mut u8 = &mut 0;
|
||||
v8__ValueSerializer__Release(
|
||||
&mut (*self.value_serializer_heap).cxx_value_serializer,
|
||||
&mut self.value_serializer_heap.cxx_value_serializer,
|
||||
&mut ptr,
|
||||
&mut size,
|
||||
);
|
||||
Vec::from_raw_parts(
|
||||
ptr as *mut u8,
|
||||
size,
|
||||
(*self.value_serializer_heap).buffer_size,
|
||||
self.value_serializer_heap.buffer_size,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -463,6 +465,6 @@ impl<'a, 's> ValueSerializer<'a, 's> {
|
|||
context: Local<Context>,
|
||||
value: Local<Value>,
|
||||
) -> Option<bool> {
|
||||
(*self.value_serializer_heap).write_value(context, value)
|
||||
self.value_serializer_heap.write_value(context, value)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,40 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandl
|
|||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the following other types implement trait `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>>
|
||||
<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>>
|
||||
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`
|
||||
|
||||
error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied
|
||||
--> 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`
|
||||
|
|
||||
= help: the following other types implement trait `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>>
|
||||
<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>>
|
||||
|
||||
error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandleScope<'_, '_>` is not satisfied
|
||||
--> 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`
|
||||
|
|
||||
= help: the following other types implement trait `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>>
|
||||
<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>>
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/object_without_context_scope.rs:6:33
|
||||
|
|
||||
6 | let _object = v8::Object::new(&mut scope);
|
||||
| ^^^^^^^^^^ expected struct `v8::Context`, found `()`
|
||||
|
|
||||
= 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 struct `v8::Context`, found `()`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected mutable reference `&mut HandleScope<'_>`
|
||||
found mutable reference `&mut HandleScope<'_, ()>`
|
||||
note: associated function defined here
|
||||
--> src/object.rs
|
||||
|
|
||||
| pub fn new<'s>(scope: &mut HandleScope<'s>) -> Local<'s, Object> {
|
||||
| ^^^
|
||||
|
|
|
@ -5770,7 +5770,9 @@ fn synthetic_evaluation_steps<'a>(
|
|||
let scope = &mut v8::TryCatch::new(scope);
|
||||
let name = v8::String::new(scope, "does not exist").unwrap();
|
||||
let value = v8::undefined(scope).into();
|
||||
assert!(module.set_synthetic_module_export(scope, name, value) == None);
|
||||
assert!(module
|
||||
.set_synthetic_module_export(scope, name, value)
|
||||
.is_none());
|
||||
assert!(scope.has_caught());
|
||||
scope.reset();
|
||||
}
|
||||
|
@ -6282,7 +6284,7 @@ impl<'a> Custom2Value {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> v8::ValueSerializerImpl for Custom2Value {
|
||||
impl v8::ValueSerializerImpl for Custom2Value {
|
||||
#[allow(unused_variables)]
|
||||
fn throw_data_clone_error<'s>(
|
||||
&mut self,
|
||||
|
@ -6496,7 +6498,7 @@ fn run_with_rust_allocator() {
|
|||
}
|
||||
unsafe extern "C" fn free(count: &AtomicUsize, data: *mut c_void, n: usize) {
|
||||
count.fetch_sub(n, Ordering::SeqCst);
|
||||
Box::from_raw(std::slice::from_raw_parts_mut(data as *mut u8, n));
|
||||
let _ = Box::from_raw(std::slice::from_raw_parts_mut(data as *mut u8, n));
|
||||
}
|
||||
unsafe extern "C" fn reallocate(
|
||||
count: &AtomicUsize,
|
||||
|
@ -7373,7 +7375,7 @@ fn weak_handle() {
|
|||
let scope = &mut v8::HandleScope::new(scope);
|
||||
let local = v8::Object::new(scope);
|
||||
|
||||
let weak = v8::Weak::new(scope, &local);
|
||||
let weak = v8::Weak::new(scope, local);
|
||||
assert!(!weak.is_empty());
|
||||
assert_eq!(weak, local);
|
||||
assert_eq!(weak.to_local(scope), Some(local));
|
||||
|
@ -7408,7 +7410,7 @@ fn finalizers() {
|
|||
let scope = &mut v8::HandleScope::new(scope);
|
||||
let local = v8::Object::new(scope);
|
||||
let _ =
|
||||
v8::Weak::with_finalizer(scope, &local, Box::new(|_| unreachable!()));
|
||||
v8::Weak::with_finalizer(scope, local, Box::new(|_| unreachable!()));
|
||||
}
|
||||
|
||||
let scope = &mut v8::HandleScope::new(scope);
|
||||
|
@ -7429,7 +7431,7 @@ fn finalizers() {
|
|||
|
||||
let weak = Rc::new(v8::Weak::with_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new(move |_| {
|
||||
let (weak, finalizer_called) = rx.try_recv().unwrap();
|
||||
finalizer_called.set(true);
|
||||
|
@ -7475,7 +7477,7 @@ fn guaranteed_finalizers() {
|
|||
let local = v8::Object::new(scope);
|
||||
let _ = v8::Weak::with_guaranteed_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new(|| unreachable!()),
|
||||
);
|
||||
}
|
||||
|
@ -7498,7 +7500,7 @@ fn guaranteed_finalizers() {
|
|||
|
||||
let weak = Rc::new(v8::Weak::with_guaranteed_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new(move || {
|
||||
let (weak, finalizer_called) = rx.try_recv().unwrap();
|
||||
finalizer_called.set(true);
|
||||
|
@ -7568,10 +7570,10 @@ fn weak_from_into_raw() {
|
|||
let (weak1, weak2) = {
|
||||
let scope = &mut v8::HandleScope::new(scope);
|
||||
let local = v8::Object::new(scope);
|
||||
let weak = v8::Weak::new(scope, &local);
|
||||
let weak = v8::Weak::new(scope, local);
|
||||
let weak_with_finalizer = v8::Weak::with_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new({
|
||||
let finalizer_called = finalizer_called.clone();
|
||||
move |_| {
|
||||
|
@ -7601,7 +7603,7 @@ fn weak_from_into_raw() {
|
|||
let weak = {
|
||||
let scope = &mut v8::HandleScope::new(scope);
|
||||
let local = v8::Object::new(scope);
|
||||
v8::Weak::new(scope, &local)
|
||||
v8::Weak::new(scope, local)
|
||||
};
|
||||
assert!(!weak.is_empty());
|
||||
eval(scope, "gc()").unwrap();
|
||||
|
@ -7615,10 +7617,10 @@ fn weak_from_into_raw() {
|
|||
let (weak, weak_with_finalizer) = {
|
||||
let scope = &mut v8::HandleScope::new(scope);
|
||||
let local = v8::Object::new(scope);
|
||||
let weak = v8::Weak::new(scope, &local);
|
||||
let weak = v8::Weak::new(scope, local);
|
||||
let weak_with_finalizer = v8::Weak::with_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new({
|
||||
let finalizer_called = finalizer_called.clone();
|
||||
move |_| {
|
||||
|
@ -7674,7 +7676,7 @@ fn drop_weak_from_raw_in_finalizer() {
|
|||
let local = v8::Object::new(scope);
|
||||
let weak = v8::Weak::with_finalizer(
|
||||
scope,
|
||||
&local,
|
||||
local,
|
||||
Box::new({
|
||||
let weak_ptr = weak_ptr.clone();
|
||||
let finalized = finalized.clone();
|
||||
|
@ -7749,10 +7751,10 @@ fn finalizer_on_kept_global() {
|
|||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
let object = v8::Object::new(scope);
|
||||
global = v8::Global::new(scope, &object);
|
||||
global = v8::Global::new(scope, object);
|
||||
weak1 = v8::Weak::with_finalizer(
|
||||
scope,
|
||||
&object,
|
||||
object,
|
||||
Box::new({
|
||||
let finalized = regular_finalized.clone();
|
||||
move |_| finalized.set(true)
|
||||
|
@ -7760,7 +7762,7 @@ fn finalizer_on_kept_global() {
|
|||
);
|
||||
weak2 = v8::Weak::with_guaranteed_finalizer(
|
||||
scope,
|
||||
&object,
|
||||
object,
|
||||
Box::new({
|
||||
let guaranteed_finalized = guaranteed_finalized.clone();
|
||||
move || guaranteed_finalized.set(true)
|
||||
|
|
Loading…
Reference in a new issue