Browse Source

Bump dependencies with breaking changes (#4050)

pull/4052/head
José Julián Espina 4 days ago committed by GitHub
parent
commit
9b7c8ce986
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 543
      Cargo.lock
  2. 19
      Cargo.toml
  3. 4
      cli/src/helper.rs
  4. 24
      core/engine/src/host_defined.rs
  5. 2
      core/gc/Cargo.toml
  6. 72
      core/gc/src/pointers/weak_map.rs
  7. 2
      core/interner/Cargo.toml
  8. 3
      core/runtime/Cargo.toml
  9. 4
      examples/src/bin/host_defined.rs

543
Cargo.lock generated

File diff suppressed because it is too large Load Diff

19
Cargo.toml

@ -51,7 +51,7 @@ bitflags = "2.5.0"
clap = "4.5.21" clap = "4.5.21"
colored = "2.1.0" colored = "2.1.0"
fast-float = "0.2.0" fast-float = "0.2.0"
hashbrown = { version = "0.14.5", default-features = false } hashbrown = "0.15.1"
indexmap = { version = "2.6.0", default-features = false } indexmap = { version = "2.6.0", default-features = false }
indoc = "2.0.5" indoc = "2.0.5"
jemallocator = "0.5.4" jemallocator = "0.5.4"
@ -59,7 +59,7 @@ num-bigint = "0.4.6"
num-traits = "0.2.19" num-traits = "0.2.19"
once_cell = { version = "1.20.2", default-features = false } once_cell = { version = "1.20.2", default-features = false }
phf = { version = "0.11.2", default-features = false } phf = { version = "0.11.2", default-features = false }
pollster = "0.3.0" pollster = "0.4.0"
regex = "1.11.1" regex = "1.11.1"
regress = { version = "0.10.1", features = ["utf16"] } regress = { version = "0.10.1", features = ["utf16"] }
rustc-hash = { version = "2.0.0", default-features = false } rustc-hash = { version = "2.0.0", default-features = false }
@ -72,7 +72,7 @@ time = { version = "0.3.36", default-features = false, features = ["local-offset
tinystr = "0.7.5" tinystr = "0.7.5"
log = "0.4.22" log = "0.4.22"
simple_logger = "5.0.0" simple_logger = "5.0.0"
cargo_metadata = "0.18.1" cargo_metadata = "0.19.0"
trybuild = "1.0.101" trybuild = "1.0.101"
rayon = "1.10.0" rayon = "1.10.0"
toml = "0.8.19" toml = "0.8.19"
@ -87,21 +87,21 @@ wasm-bindgen-test = "0.3.45"
smol = "2.0.2" smol = "2.0.2"
futures-util = "0.3.31" futures-util = "0.3.31"
isahc = "1.7.2" isahc = "1.7.2"
rustyline = { version = "14.0.0", default-features = false } rustyline = { version = "15.0.0", default-features = false }
dhat = "0.3.3" dhat = "0.3.3"
quote = "1.0.37" quote = "1.0.37"
syn = { version = "2.0.87", default-features = false } syn = { version = "2.0.89", default-features = false }
proc-macro2 = "1.0" proc-macro2 = "1.0"
synstructure = "0.13" synstructure = "0.13"
measureme = "11.0.1" measureme = "12.0.0"
sptr = "0.3.2" sptr = "0.3.2"
paste = "1.0" paste = "1.0"
rand = "0.8.5" rand = "0.8.5"
num-integer = "0.1.46" num-integer = "0.1.46"
ryu-js = "1.0.1" ryu-js = "1.0.1"
tap = "1.0.1" tap = "1.0.1"
thiserror = "1.0.69" thiserror = { version = "2.0.3", default-features = false }
dashmap = "5.5.3" dashmap = "6.1.0"
num_enum = "0.7.3" num_enum = "0.7.3"
itertools = { version = "0.13.0", default-features = false } itertools = { version = "0.13.0", default-features = false }
portable-atomic = "1.9.0" portable-atomic = "1.9.0"
@ -114,10 +114,11 @@ sys-locale = "0.3.2"
temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "1e7901d07a83211e62373ab94284a7d1ada4c913" } temporal_rs = { git = "https://github.com/boa-dev/temporal.git", rev = "1e7901d07a83211e62373ab94284a7d1ada4c913" }
web-time = "1.1.0" web-time = "1.1.0"
criterion = "0.5.1" criterion = "0.5.1"
float-cmp = "0.9.0" float-cmp = "0.10.0"
futures-lite = "2.5.0" futures-lite = "2.5.0"
test-case = "3.3.1" test-case = "3.3.1"
winapi = { version = "0.3.9", default-features = false } winapi = { version = "0.3.9", default-features = false }
url = "2.5.3"
# ICU4X # ICU4X

4
cli/src/helper.rs

@ -3,7 +3,7 @@ use phf::{phf_set, Set};
use regex::{Captures, Regex, Replacer}; use regex::{Captures, Regex, Replacer};
use rustyline::{ use rustyline::{
error::ReadlineError, error::ReadlineError,
highlight::Highlighter, highlight::{CmdKind, Highlighter},
validate::{MatchingBracketValidator, ValidationContext, ValidationResult, Validator}, validate::{MatchingBracketValidator, ValidationContext, ValidationResult, Validator},
Completer, Helper, Hinter, Completer, Helper, Hinter,
}; };
@ -97,7 +97,7 @@ impl Highlighter for RLHelper {
self.highlighter.highlight(candidate, 0) self.highlighter.highlight(candidate, 0)
} }
fn highlight_char(&self, line: &str, _: usize, _: bool) -> bool { fn highlight_char(&self, line: &str, _: usize, _: CmdKind) -> bool {
!line.is_empty() !line.is_empty()
} }
} }

24
core/engine/src/host_defined.rs

@ -80,16 +80,16 @@ impl HostDefined {
.and_then(<dyn NativeObject>::downcast_mut::<T>) .and_then(<dyn NativeObject>::downcast_mut::<T>)
} }
/// Get type a tuple of types from [`HostDefined`], if they exist. /// Get a tuple of types from [`HostDefined`], returning `None` for the types that are not on the map.
#[track_caller] #[track_caller]
pub fn get_many_mut<T, const SIZE: usize>(&mut self) -> Option<T::NativeTupleMutRef<'_>> pub fn get_many_mut<T, const SIZE: usize>(&mut self) -> T::NativeTupleMutRef<'_>
where where
T: NativeTuple<SIZE>, T: NativeTuple<SIZE>,
{ {
let ids = T::as_type_ids(); let ids = T::as_type_ids();
let refs: [&TypeId; SIZE] = std::array::from_fn(|i| &ids[i]); let refs: [&TypeId; SIZE] = std::array::from_fn(|i| &ids[i]);
self.types.get_many_mut(refs).and_then(T::mut_ref_from_anys) T::mut_ref_from_anys(self.types.get_many_mut(refs))
} }
/// Clears all the objects. /// Clears all the objects.
@ -109,27 +109,27 @@ pub trait NativeTuple<const SIZE: usize> {
fn as_type_ids() -> [TypeId; SIZE]; fn as_type_ids() -> [TypeId; SIZE];
fn mut_ref_from_anys( fn mut_ref_from_anys(
anys: [&'_ mut Box<dyn NativeObject>; SIZE], anys: [Option<&'_ mut Box<dyn NativeObject>>; SIZE],
) -> Option<Self::NativeTupleMutRef<'_>>; ) -> Self::NativeTupleMutRef<'_>;
} }
macro_rules! impl_native_tuple { macro_rules! impl_native_tuple {
($size:literal $(,$name:ident)* ) => { ($size:literal $(,$name:ident)* ) => {
impl<$($name: NativeObject,)*> NativeTuple<$size> for ($($name,)*) { impl<$($name: NativeObject,)*> NativeTuple<$size> for ($($name,)*) {
type NativeTupleMutRef<'a> = ($(&'a mut $name,)*); type NativeTupleMutRef<'a> = ($(Option<&'a mut $name>,)*);
fn as_type_ids() -> [TypeId; $size] { fn as_type_ids() -> [TypeId; $size] {
[$(TypeId::of::<$name>(),)*] [$(TypeId::of::<$name>(),)*]
} }
#[allow(unused_variables, unused_mut, clippy::unused_unit)]
fn mut_ref_from_anys( fn mut_ref_from_anys(
anys: [&'_ mut Box<dyn NativeObject>; $size], anys: [Option<&'_ mut Box<dyn NativeObject>>; $size],
) -> Option<Self::NativeTupleMutRef<'_>> { ) -> Self::NativeTupleMutRef<'_> {
#[allow(unused_variables, unused_mut)]
let mut anys = anys.into_iter(); let mut anys = anys.into_iter();
Some(($( ($(
anys.next().expect("Expect `anys` to be of length `SIZE`").downcast_mut::<$name>()?, anys.next().flatten().and_then(|v| v.downcast_mut::<$name>()),
)*)) )*)
} }
} }
} }

2
core/gc/Cargo.toml

@ -21,7 +21,7 @@ boa_string = ["dep:boa_string"]
[dependencies] [dependencies]
boa_profiler.workspace = true boa_profiler.workspace = true
boa_macros.workspace = true boa_macros.workspace = true
hashbrown = { workspace = true, features = ["ahash", "raw"] } hashbrown.workspace = true
boa_string = { workspace = true, optional = true } boa_string = { workspace = true, optional = true }
thin-vec = { workspace = true, optional = true } thin-vec = { workspace = true, optional = true }

72
core/gc/src/pointers/weak_map.rs

@ -2,13 +2,12 @@
// but with some adjustments to use `Ephemeron<K,V>` instead of `(K,V)` // but with some adjustments to use `Ephemeron<K,V>` instead of `(K,V)`
use hashbrown::{ use hashbrown::{
hash_map::DefaultHashBuilder, hash_table::{Entry as RawEntry, Iter as RawIter},
raw::{RawIter, RawTable}, DefaultHashBuilder, HashTable, TryReserveError,
TryReserveError,
}; };
use crate::{custom_trace, Allocator, Ephemeron, Finalize, Gc, GcRefCell, Trace}; use crate::{custom_trace, Allocator, Ephemeron, Finalize, Gc, GcRefCell, Trace};
use std::{fmt, hash::BuildHasher, marker::PhantomData, mem}; use std::{fmt, hash::BuildHasher, marker::PhantomData};
/// A map that holds weak references to its keys and is traced by the garbage collector. /// A map that holds weak references to its keys and is traced by the garbage collector.
#[derive(Clone, Debug, Default, Finalize)] #[derive(Clone, Debug, Default, Finalize)]
@ -68,7 +67,7 @@ where
V: Trace + 'static, V: Trace + 'static,
{ {
hash_builder: S, hash_builder: S,
table: RawTable<Ephemeron<K, V>>, table: HashTable<Ephemeron<K, V>>,
} }
impl<K, V, S> Finalize for RawWeakMap<K, V, S> impl<K, V, S> Finalize for RawWeakMap<K, V, S>
@ -138,7 +137,7 @@ where
pub(crate) const fn with_hasher(hash_builder: S) -> Self { pub(crate) const fn with_hasher(hash_builder: S) -> Self {
Self { Self {
hash_builder, hash_builder,
table: RawTable::new(), table: HashTable::new(),
} }
} }
@ -150,7 +149,7 @@ where
pub(crate) fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self { pub(crate) fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self {
Self { Self {
hash_builder, hash_builder,
table: RawTable::with_capacity(capacity), table: HashTable::with_capacity(capacity),
} }
} }
@ -172,12 +171,9 @@ where
/// An iterator visiting all entries in arbitrary order. /// An iterator visiting all entries in arbitrary order.
/// The iterator element type is <code>[Ephemeron]<K, V></code>. /// The iterator element type is <code>[Ephemeron]<K, V></code>.
pub(crate) fn iter(&self) -> Iter<'_, K, V> { pub(crate) fn iter(&self) -> Iter<'_, K, V> {
// SAFETY: The returned iterator is tied to the lifetime of self. Iter {
unsafe { inner: self.table.iter(),
Iter { marker: PhantomData,
inner: self.table.iter(),
marker: PhantomData,
}
} }
} }
@ -212,14 +208,7 @@ where
// SAFETY: // SAFETY:
// - `item` is only used internally, which means it outlives self. // - `item` is only used internally, which means it outlives self.
// - `item` pointer is not used after the call to `erase`. // - `item` pointer is not used after the call to `erase`.
unsafe { self.table.retain(|item| f(item));
for item in self.table.iter() {
let eph = item.as_ref();
if !f(eph) {
self.table.erase(item);
}
}
}
} }
/// Clears the map, removing all key-value pairs. Keeps the allocated memory /// Clears the map, removing all key-value pairs. Keeps the allocated memory
@ -293,7 +282,7 @@ where
None None
} else { } else {
let hash = make_hash_from_gc(&self.hash_builder, k); let hash = make_hash_from_gc(&self.hash_builder, k);
self.table.get(hash, equivalent_key(k))?.value() self.table.find(hash, equivalent_key(k))?.value()
} }
} }
@ -311,30 +300,29 @@ where
pub(crate) fn insert(&mut self, k: &Gc<K>, v: V) -> Option<Ephemeron<K, V>> { pub(crate) fn insert(&mut self, k: &Gc<K>, v: V) -> Option<Ephemeron<K, V>> {
let hash = make_hash_from_gc(&self.hash_builder, k); let hash = make_hash_from_gc(&self.hash_builder, k);
let hasher = make_hasher(&self.hash_builder); let hasher = make_hasher(&self.hash_builder);
let eph = Ephemeron::new(k, v); let entry = self.table.entry(hash, equivalent_key(k), hasher);
match self let (old, slot) = match entry {
.table RawEntry::Occupied(occupied_entry) => {
.find_or_find_insert_slot(hash, equivalent_key(k), hasher) let (v, slot) = occupied_entry.remove();
{ (Some(v), slot)
// SAFETY: `bucket` is only used inside the replace call, meaning it doesn't
// outlive self.
Ok(bucket) => Some(mem::replace(unsafe { bucket.as_mut() }, eph)),
Err(slot) => {
// SAFETY: `slot` comes from a call to `find_or_find_insert_slot`, and `self`
// is not mutated until the call to `insert_in_slot`.
unsafe {
self.table.insert_in_slot(hash, slot, eph);
}
None
} }
} RawEntry::Vacant(vacant_entry) => (None, vacant_entry),
};
slot.insert(Ephemeron::new(k, v));
old
} }
/// Removes a key from the map, returning the value at the key if the key /// Removes a key from the map, returning the value at the key if the key
/// was previously in the map. Keeps the allocated memory for reuse. /// was previously in the map. Keeps the allocated memory for reuse.
pub(crate) fn remove(&mut self, k: &Gc<K>) -> Option<V> { pub(crate) fn remove(&mut self, k: &Gc<K>) -> Option<V> {
let hash = make_hash_from_gc(&self.hash_builder, k); let hash = make_hash_from_gc(&self.hash_builder, k);
self.table.remove_entry(hash, equivalent_key(k))?.value() self.table
.find_entry(hash, equivalent_key(k))
.ok()?
.remove()
.0
.value()
} }
/// Clears all the expired keys in the map. /// Clears all the expired keys in the map.
@ -348,7 +336,7 @@ where
K: Trace + ?Sized + 'static, K: Trace + ?Sized + 'static,
V: Trace + 'static, V: Trace + 'static,
{ {
inner: RawIter<Ephemeron<K, V>>, inner: RawIter<'a, Ephemeron<K, V>>,
marker: PhantomData<&'a Ephemeron<K, V>>, marker: PhantomData<&'a Ephemeron<K, V>>,
} }
@ -386,9 +374,7 @@ where
#[inline] #[inline]
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
// SAFETY: The original map outlives the iterator thanks to the lifetime parameter, self.inner.next()
// and since the returned ephemeron carries that information, the call to `as_ref` is safe.
unsafe { self.inner.next().map(|b| b.as_ref()) }
} }
#[inline] #[inline]

2
core/interner/Cargo.toml

@ -24,7 +24,7 @@ once_cell = { workspace = true, features = ["std"]}
indexmap.workspace = true indexmap.workspace = true
serde = { workspace = true, features = ["derive"], optional = true } serde = { workspace = true, features = ["derive"], optional = true }
arbitrary = { workspace = true, features = ["derive"], optional = true } arbitrary = { workspace = true, features = ["derive"], optional = true }
hashbrown = { workspace = true, default-features = false, features = ["inline-more"] } hashbrown.workspace = true
[lints] [lints]
workspace = true workspace = true

3
core/runtime/Cargo.toml

@ -15,7 +15,7 @@ boa_engine.workspace = true
boa_gc.workspace = true boa_gc.workspace = true
boa_interop.workspace = true boa_interop.workspace = true
rustc-hash = { workspace = true, features = ["std"] } rustc-hash = { workspace = true, features = ["std"] }
url = { version = "2.5.3", optional = true } url = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
indoc.workspace = true indoc.workspace = true
@ -30,3 +30,4 @@ all-features = true
[features] [features]
default = ["all"] default = ["all"]
all = ["url"] all = ["url"]
url = ["dep:url"]

4
examples/src/bin/host_defined.rs

@ -96,11 +96,11 @@ fn main() -> Result<(), JsError> {
let value: usize = args.get_or_undefined(0).try_js_into(context)?; let value: usize = args.get_or_undefined(0).try_js_into(context)?;
let mut host_defined = context.realm().host_defined_mut(); let mut host_defined = context.realm().host_defined_mut();
let Some((host_defined, metrics)) = let (Some(host_defined), Some(metrics)) =
host_defined.get_many_mut::<(CustomHostDefinedStruct, HostDefinedMetrics), 2>() host_defined.get_many_mut::<(CustomHostDefinedStruct, HostDefinedMetrics), 2>()
else { else {
return Err(JsNativeError::typ() return Err(JsNativeError::typ()
.with_message("Realm does not have HostDefined field") .with_message("Realm does not have HostDefined fields")
.into()); .into());
}; };

Loading…
Cancel
Save