Switch the majority of fxhash uses to rustc_hash which is maintained (#39168)

fxhash seems to be unmaintained (see
https://github.com/rustsec/advisory-db/issues/2185) so we should move
away from it.
Additionally, the new crate might be slightly faster.

There is still some cases depending on stylo that have the old fxhash
crate.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Changes in Hash should really not show any bugs. And
performance should be comparable.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-09-06 07:19:47 +02:00 committed by GitHub
parent d67a7bad39
commit e64c53972a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 11 additions and 6 deletions

4
Cargo.lock generated
View file

@ -4873,6 +4873,7 @@ dependencies = [
"quickcheck", "quickcheck",
"range", "range",
"rayon", "rayon",
"rustc-hash 2.1.1",
"script", "script",
"script_traits", "script_traits",
"selectors", "selectors",
@ -4910,7 +4911,6 @@ dependencies = [
"fnv", "fnv",
"fonts", "fonts",
"fonts_traits", "fonts_traits",
"fxhash",
"html5ever", "html5ever",
"ipc-channel", "ipc-channel",
"libc", "libc",
@ -4920,6 +4920,7 @@ dependencies = [
"pixels", "pixels",
"profile_traits", "profile_traits",
"range", "range",
"rustc-hash 2.1.1",
"script_traits", "script_traits",
"selectors", "selectors",
"serde", "serde",
@ -7376,6 +7377,7 @@ dependencies = [
"profile_traits", "profile_traits",
"range", "range",
"regex", "regex",
"rustc-hash 2.1.1",
"script_bindings", "script_bindings",
"script_traits", "script_traits",
"selectors", "selectors",

View file

@ -126,6 +126,7 @@ resvg = "0.45.0"
rustls = { version = "0.23", default-features = false, features = ["logging", "std", "tls12"] } rustls = { version = "0.23", default-features = false, features = ["logging", "std", "tls12"] }
rustls-pemfile = "2.0" rustls-pemfile = "2.0"
rustls-pki-types = "1.12" rustls-pki-types = "1.12"
rustc-hash = "2.1.1"
script_traits = { path = "components/shared/script" } script_traits = { path = "components/shared/script" }
selectors = { git = "https://github.com/servo/stylo", branch = "2025-09-02" } selectors = { git = "https://github.com/servo/stylo", branch = "2025-09-02" }
serde = "1.0.219" serde = "1.0.219"

View file

@ -46,6 +46,7 @@ pixels = { path = "../pixels" }
profile_traits = { workspace = true } profile_traits = { workspace = true }
range = { path = "../range" } range = { path = "../range" }
rayon = { workspace = true } rayon = { workspace = true }
rustc-hash = { workspace = true }
script = { path = "../script" } script = { path = "../script" }
script_traits = { workspace = true } script_traits = { workspace = true }
selectors = { workspace = true } selectors = { workspace = true }

View file

@ -8,7 +8,6 @@ use embedder_traits::UntrustedNodeAddress;
use euclid::Size2D; use euclid::Size2D;
use fnv::FnvHashMap; use fnv::FnvHashMap;
use fonts::FontContext; use fonts::FontContext;
use fxhash::FxHashMap;
use layout_api::wrapper_traits::ThreadSafeLayoutNode; use layout_api::wrapper_traits::ThreadSafeLayoutNode;
use layout_api::{ use layout_api::{
IFrameSizes, ImageAnimationState, PendingImage, PendingImageState, PendingRasterizationImage, IFrameSizes, ImageAnimationState, PendingImage, PendingImageState, PendingRasterizationImage,
@ -19,6 +18,7 @@ use net_traits::image_cache::{
}; };
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use pixels::RasterImage; use pixels::RasterImage;
use rustc_hash::FxHashMap;
use script::layout_dom::ServoThreadSafeLayoutNode; use script::layout_dom::ServoThreadSafeLayoutNode;
use servo_url::{ImmutableOrigin, ServoUrl}; use servo_url::{ImmutableOrigin, ServoUrl};
use style::context::SharedStyleContext; use style::context::SharedStyleContext;

View file

@ -7,8 +7,8 @@ use std::cell::Cell;
use app_units::Au; use app_units::Au;
use base::print_tree::PrintTree; use base::print_tree::PrintTree;
use compositing_traits::display_list::AxesScrollSensitivity; use compositing_traits::display_list::AxesScrollSensitivity;
use fxhash::FxHashSet;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use rustc_hash::FxHashSet;
use style::animation::AnimationSetKey; use style::animation::AnimationSetKey;
use style::computed_values::position::T as Position; use style::computed_values::position::T as Position;

View file

@ -100,6 +100,7 @@ parking_lot = { workspace = true }
percent-encoding = { workspace = true } percent-encoding = { workspace = true }
phf = "0.11" phf = "0.11"
pixels = { path = "../pixels" } pixels = { path = "../pixels" }
rustc-hash = { workspace = true }
profile_traits = { workspace = true } profile_traits = { workspace = true }
range = { path = "../range" } range = { path = "../range" }
regex = { workspace = true } regex = { workspace = true }

View file

@ -8,12 +8,12 @@ use std::time::Duration;
use compositing_traits::{ImageUpdate, SerializableImageData}; use compositing_traits::{ImageUpdate, SerializableImageData};
use embedder_traits::UntrustedNodeAddress; use embedder_traits::UntrustedNodeAddress;
use fxhash::FxHashMap;
use ipc_channel::ipc::IpcSharedMemory; use ipc_channel::ipc::IpcSharedMemory;
use layout_api::ImageAnimationState; use layout_api::ImageAnimationState;
use libc::c_void; use libc::c_void;
use malloc_size_of::MallocSizeOf; use malloc_size_of::MallocSizeOf;
use parking_lot::RwLock; use parking_lot::RwLock;
use rustc_hash::FxHashMap;
use script_bindings::codegen::GenericBindings::WindowBinding::WindowMethods; use script_bindings::codegen::GenericBindings::WindowBinding::WindowMethods;
use script_bindings::root::Dom; use script_bindings::root::Dom;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;

View file

@ -23,7 +23,6 @@ euclid = { workspace = true }
fnv = { workspace = true } fnv = { workspace = true }
fonts = { path = "../../fonts" } fonts = { path = "../../fonts" }
fonts_traits = { workspace = true } fonts_traits = { workspace = true }
fxhash = { workspace = true }
html5ever = { workspace = true } html5ever = { workspace = true }
ipc-channel = { workspace = true } ipc-channel = { workspace = true }
libc = { workspace = true } libc = { workspace = true }
@ -33,6 +32,7 @@ net_traits = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
pixels = { path = "../../pixels" } pixels = { path = "../../pixels" }
profile_traits = { workspace = true } profile_traits = { workspace = true }
rustc-hash = { workspace = true }
range = { path = "../../range" } range = { path = "../../range" }
script_traits = { workspace = true } script_traits = { workspace = true }
selectors = { workspace = true } selectors = { workspace = true }

View file

@ -30,7 +30,6 @@ use euclid::Point2D;
use euclid::default::{Point2D as UntypedPoint2D, Rect}; use euclid::default::{Point2D as UntypedPoint2D, Rect};
use fnv::FnvHashMap; use fnv::FnvHashMap;
use fonts::{FontContext, SystemFontServiceProxy}; use fonts::{FontContext, SystemFontServiceProxy};
use fxhash::FxHashMap;
pub use layout_damage::LayoutDamage; pub use layout_damage::LayoutDamage;
use libc::c_void; use libc::c_void;
use malloc_size_of::{MallocSizeOf as MallocSizeOfTrait, MallocSizeOfOps, malloc_size_of_is_0}; use malloc_size_of::{MallocSizeOf as MallocSizeOfTrait, MallocSizeOfOps, malloc_size_of_is_0};
@ -40,6 +39,7 @@ use parking_lot::RwLock;
use pixels::RasterImage; use pixels::RasterImage;
use profile_traits::mem::Report; use profile_traits::mem::Report;
use profile_traits::time; use profile_traits::time;
use rustc_hash::FxHashMap;
use script_traits::{InitialScriptState, Painter, ScriptThreadMessage}; use script_traits::{InitialScriptState, Painter, ScriptThreadMessage};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;