From fc7703044a1e5b9447587945a51ab998ede7f37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 19 Oct 2024 18:27:49 +0200 Subject: [PATCH] feat: add rustc-hash feature Changes in preparation of [rust-lang/rust#131936][1]: - Introduce `rustc-hash` dependency and feature. - Modify the `update.sh` script accordingly. [1]: https://github.com/rust-lang/rust/pull/131936 --- Cargo.toml | 10 ++++++++++ update.sh | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bfbee52..54a03ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,16 @@ repository = "https://github.com/rust-lang/rustdoc-types" [dependencies] serde = {version="1", features=["derive"]} +rustc-hash = {version="2", optional=true} + +[features] +default = [] + +# Switch the hashmaps used in rustdoc-types to the FxHashMap from rustc-hash. +# +# This might improve performace if your are reading the rustdoc JSON from large +# crates like aws_sdk_ec2 +rustc-hash = ["dep:rustc-hash"] [dev-dependencies] bincode = "1.3.3" diff --git a/update.sh b/update.sh index 6d10f2c..65612f4 100755 --- a/update.sh +++ b/update.sh @@ -9,9 +9,7 @@ repo="rust" branch="master" curl -# https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/rustdoc-json-types/lib.rs \ - | sed 's/rustc_hash::/std::collections::/g' \ - | sed 's/FxHashMap/HashMap/g' \ - | sed 's/^pub use /use /' \ + | sed '/^pub type FxHashMap.*$/d' \ > src/lib.rs curl -# https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/rustdoc-json-types/tests.rs > src/tests.rs