Browse Source

Bump dependencies with breaking changes (#4050)

pull/4052/head
José Julián Espina 1 week 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"
colored = "2.1.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 }
indoc = "2.0.5"
jemallocator = "0.5.4"
@ -59,7 +59,7 @@ num-bigint = "0.4.6"
num-traits = "0.2.19"
once_cell = { version = "1.20.2", default-features = false }
phf = { version = "0.11.2", default-features = false }
pollster = "0.3.0"
pollster = "0.4.0"
regex = "1.11.1"
regress = { version = "0.10.1", features = ["utf16"] }
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"
log = "0.4.22"
simple_logger = "5.0.0"
cargo_metadata = "0.18.1"
cargo_metadata = "0.19.0"
trybuild = "1.0.101"
rayon = "1.10.0"
toml = "0.8.19"
@ -87,21 +87,21 @@ wasm-bindgen-test = "0.3.45"
smol = "2.0.2"
futures-util = "0.3.31"
isahc = "1.7.2"
rustyline = { version = "14.0.0", default-features = false }
rustyline = { version = "15.0.0", default-features = false }
dhat = "0.3.3"
quote = "1.0.37"
syn = { version = "2.0.87", default-features = false }
syn = { version = "2.0.89", default-features = false }
proc-macro2 = "1.0"
synstructure = "0.13"
measureme = "11.0.1"
measureme = "12.0.0"
sptr = "0.3.2"
paste = "1.0"
rand = "0.8.5"
num-integer = "0.1.46"
ryu-js = "1.0.1"
tap = "1.0.1"
thiserror = "1.0.69"
dashmap = "5.5.3"
thiserror = { version = "2.0.3", default-features = false }
dashmap = "6.1.0"
num_enum = "0.7.3"
itertools = { version = "0.13.0", default-features = false }
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" }
web-time = "1.1.0"
criterion = "0.5.1"
float-cmp = "0.9.0"
float-cmp = "0.10.0"
futures-lite = "2.5.0"
test-case = "3.3.1"
winapi = { version = "0.3.9", default-features = false }
url = "2.5.3"
# ICU4X

4
cli/src/helper.rs

@ -3,7 +3,7 @@ use phf::{phf_set, Set};
use regex::{Captures, Regex, Replacer};
use rustyline::{
error::ReadlineError,
highlight::Highlighter,
highlight::{CmdKind, Highlighter},
validate::{MatchingBracketValidator, ValidationContext, ValidationResult, Validator},
Completer, Helper, Hinter,
};
@ -97,7 +97,7 @@ impl Highlighter for RLHelper {
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()
}
}

24
core/engine/src/host_defined.rs

@ -80,16 +80,16 @@ impl HostDefined {
.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]
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
T: NativeTuple<SIZE>,
{
let ids = T::as_type_ids();
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.
@ -109,27 +109,27 @@ pub trait NativeTuple<const SIZE: usize> {
fn as_type_ids() -> [TypeId; SIZE];
fn mut_ref_from_anys(
anys: [&'_ mut Box<dyn NativeObject>; SIZE],
) -> Option<Self::NativeTupleMutRef<'_>>;
anys: [Option<&'_ mut Box<dyn NativeObject>>; SIZE],
) -> Self::NativeTupleMutRef<'_>;
}
macro_rules! impl_native_tuple {
($size:literal $(,$name:ident)* ) => {
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] {
[$(TypeId::of::<$name>(),)*]
}
#[allow(unused_variables, unused_mut, clippy::unused_unit)]
fn mut_ref_from_anys(
anys: [&'_ mut Box<dyn NativeObject>; $size],
) -> Option<Self::NativeTupleMutRef<'_>> {
#[allow(unused_variables, unused_mut)]
anys: [Option<&'_ mut Box<dyn NativeObject>>; $size],
) -> Self::NativeTupleMutRef<'_> {
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]
boa_profiler.workspace = true
boa_macros.workspace = true
hashbrown = { workspace = true, features = ["ahash", "raw"] }
hashbrown.workspace = true
boa_string = { 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)`
use hashbrown::{
hash_map::DefaultHashBuilder,
raw::{RawIter, RawTable},
TryReserveError,
hash_table::{Entry as RawEntry, Iter as RawIter},
DefaultHashBuilder, HashTable, TryReserveError,
};
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.
#[derive(Clone, Debug, Default, Finalize)]
@ -68,7 +67,7 @@ where
V: Trace + 'static,
{
hash_builder: S,
table: RawTable<Ephemeron<K, V>>,
table: HashTable<Ephemeron<K, V>>,
}
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 {
Self {
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 {
Self {
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.
/// The iterator element type is <code>[Ephemeron]<K, V></code>.
pub(crate) fn iter(&self) -> Iter<'_, K, V> {
// SAFETY: The returned iterator is tied to the lifetime of self.
unsafe {
Iter {
inner: self.table.iter(),
marker: PhantomData,
}
Iter {
inner: self.table.iter(),
marker: PhantomData,
}
}
@ -212,14 +208,7 @@ where
// SAFETY:
// - `item` is only used internally, which means it outlives self.
// - `item` pointer is not used after the call to `erase`.
unsafe {
for item in self.table.iter() {
let eph = item.as_ref();
if !f(eph) {
self.table.erase(item);
}
}
}
self.table.retain(|item| f(item));
}
/// Clears the map, removing all key-value pairs. Keeps the allocated memory
@ -293,7 +282,7 @@ where
None
} else {
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>> {
let hash = make_hash_from_gc(&self.hash_builder, k);
let hasher = make_hasher(&self.hash_builder);
let eph = Ephemeron::new(k, v);
match self
.table
.find_or_find_insert_slot(hash, equivalent_key(k), hasher)
{
// 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
let entry = self.table.entry(hash, equivalent_key(k), hasher);
let (old, slot) = match entry {
RawEntry::Occupied(occupied_entry) => {
let (v, slot) = occupied_entry.remove();
(Some(v), slot)
}
}
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
/// was previously in the map. Keeps the allocated memory for reuse.
pub(crate) fn remove(&mut self, k: &Gc<K>) -> Option<V> {
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.
@ -348,7 +336,7 @@ where
K: Trace + ?Sized + 'static,
V: Trace + 'static,
{
inner: RawIter<Ephemeron<K, V>>,
inner: RawIter<'a, Ephemeron<K, V>>,
marker: PhantomData<&'a Ephemeron<K, V>>,
}
@ -386,9 +374,7 @@ where
#[inline]
fn next(&mut self) -> Option<Self::Item> {
// SAFETY: The original map outlives the iterator thanks to the lifetime parameter,
// and since the returned ephemeron carries that information, the call to `as_ref` is safe.
unsafe { self.inner.next().map(|b| b.as_ref()) }
self.inner.next()
}
#[inline]

2
core/interner/Cargo.toml

@ -24,7 +24,7 @@ once_cell = { workspace = true, features = ["std"]}
indexmap.workspace = true
serde = { 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]
workspace = true

3
core/runtime/Cargo.toml

@ -15,7 +15,7 @@ boa_engine.workspace = true
boa_gc.workspace = true
boa_interop.workspace = true
rustc-hash = { workspace = true, features = ["std"] }
url = { version = "2.5.3", optional = true }
url = { workspace = true, optional = true }
[dev-dependencies]
indoc.workspace = true
@ -30,3 +30,4 @@ all-features = true
[features]
default = ["all"]
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 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>()
else {
return Err(JsNativeError::typ()
.with_message("Realm does not have HostDefined field")
.with_message("Realm does not have HostDefined fields")
.into());
};

Loading…
Cancel
Save