Skip to content

Commit 79763ce

Browse files
authored
Replace fxhash with rustc-hash (#4341)
As suggested by https://rustsec.org/advisories/RUSTSEC-2025-0057.html, replacing `fxhash` crate with `rustc-hash`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent e9a7913 commit 79763ce

8 files changed

Lines changed: 13 additions & 24 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ version = "3.19.0"
217217
source = "registry+https://github.com/rust-lang/crates.io-index"
218218
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
219219

220-
[[package]]
221-
name = "byteorder"
222-
version = "1.5.0"
223-
source = "registry+https://github.com/rust-lang/crates.io-index"
224-
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
225-
226220
[[package]]
227221
name = "bytes"
228222
version = "1.10.1"
@@ -466,12 +460,12 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
466460
name = "cprover_bindings"
467461
version = "0.65.0"
468462
dependencies = [
469-
"fxhash",
470463
"lazy_static",
471464
"linear-map",
472465
"memuse",
473466
"num",
474467
"num-traits",
468+
"rustc-hash",
475469
"serde",
476470
"serde_test",
477471
"string-interner",
@@ -752,15 +746,6 @@ dependencies = [
752746
"percent-encoding",
753747
]
754748

755-
[[package]]
756-
name = "fxhash"
757-
version = "0.2.1"
758-
source = "registry+https://github.com/rust-lang/crates.io-index"
759-
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
760-
dependencies = [
761-
"byteorder",
762-
]
763-
764749
[[package]]
765750
name = "getopts"
766751
version = "0.2.24"
@@ -1113,7 +1098,6 @@ dependencies = [
11131098
"charon",
11141099
"clap",
11151100
"cprover_bindings",
1116-
"fxhash",
11171101
"itertools 0.14.0",
11181102
"kani_metadata",
11191103
"lazy_static",
@@ -1748,6 +1732,12 @@ version = "0.1.26"
17481732
source = "registry+https://github.com/rust-lang/crates.io-index"
17491733
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
17501734

1735+
[[package]]
1736+
name = "rustc-hash"
1737+
version = "2.1.1"
1738+
source = "registry+https://github.com/rust-lang/crates.io-index"
1739+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
1740+
17511741
[[package]]
17521742
name = "rustc_version"
17531743
version = "0.4.1"

cprover_bindings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ serde = {version = "1", features = ["derive"]}
2020
string-interner = "0.19"
2121
tracing = "0.1"
2222
linear-map = {version = "1.2", features = ["serde_impl"]}
23-
fxhash = "0.2.1"
23+
rustc-hash = "2.1.1"
2424

2525
[dev-dependencies]
2626
serde_test = "1"

cprover_bindings/src/irep/goto_binary_serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
use crate::irep::{Irep, IrepId, Symbol, SymbolTable};
8282
use crate::{InternString, InternedString};
8383
#[cfg(not(test))]
84-
use fxhash::FxHashMap;
84+
use rustc_hash::FxHashMap;
8585
#[cfg(test)]
8686
use std::collections::HashMap;
8787
use std::fs::File;

kani-compiler/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ publish = false
1212
cbmc = { path = "../cprover_bindings", package = "cprover_bindings", optional = true }
1313
charon = { path = "../charon/charon", optional = true, default-features = false }
1414
clap = { version = "4.4.11", features = ["derive", "cargo"] }
15-
fxhash = "0.2.1"
1615
itertools = "0.14"
1716
kani_metadata = { path = "../kani_metadata" }
1817
lazy_static = "1.5.0"

kani-compiler/src/kani_middle/attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
55
use std::collections::{BTreeMap, HashSet};
66

7-
use fxhash::FxHashMap;
87
use kani_metadata::{CbmcSolver, HarnessAttributes, HarnessKind, Stub};
98
use quote::ToTokens;
109
use rustc_ast::{LitKind, MetaItem, MetaItemKind};
10+
use rustc_data_structures::fx::FxHashMap;
1111
use rustc_errors::ErrorGuaranteed;
1212
use rustc_hir::{
1313
AttrArgs, Attribute,

kani-compiler/src/kani_middle/codegen_units.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use crate::kani_middle::reachability::filter_crate_items;
1717
use crate::kani_middle::stubbing::{check_compatibility, harness_stub_map};
1818
use crate::kani_middle::{can_derive_arbitrary, implements_arbitrary};
1919
use crate::kani_queries::QueryDb;
20-
use fxhash::{FxHashMap, FxHashSet};
2120
use kani_metadata::{
2221
ArtifactType, AssignsContract, AutoHarnessMetadata, AutoHarnessSkipReason, HarnessMetadata,
2322
KaniMetadata, find_proof_harnesses,
2423
};
2524
use regex::RegexSet;
25+
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2626
use rustc_hir::def_id::DefId;
2727
use rustc_middle::ty::TyCtxt;
2828
use rustc_public::mir::mono::Instance;

kani-compiler/src/kani_middle/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std::collections::HashSet;
77

88
use crate::kani_queries::QueryDb;
9-
use fxhash::FxHashMap;
9+
use rustc_data_structures::fx::FxHashMap;
1010
use rustc_hir::{def::DefKind, def_id::DefId as InternalDefId, def_id::LOCAL_CRATE};
1111
use rustc_middle::ty::TyCtxt;
1212
use rustc_public::mir::TerminatorKind;

kani-compiler/src/kani_middle/transform/automatic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::kani_middle::kani_functions::{KaniHook, KaniIntrinsic, KaniModel};
1414
use crate::kani_middle::transform::body::{InsertPosition, MutableBody, SourceInstruction};
1515
use crate::kani_middle::transform::{TransformPass, TransformationType};
1616
use crate::kani_queries::QueryDb;
17-
use fxhash::FxHashMap;
17+
use rustc_data_structures::fx::FxHashMap;
1818
use rustc_middle::ty::TyCtxt;
1919
use rustc_public::CrateDef;
2020
use rustc_public::mir::mono::Instance;

0 commit comments

Comments
 (0)