Skip to content

Commit

Permalink
feat: add rustc-hash feature
Browse files Browse the repository at this point in the history
Changes in preparation of [rust-lang/rust#131936][1]:

- Introduce `rustc-hash` dependency and feature.
- Modify the `update.sh` script accordingly.

[1]: rust-lang/rust#131936
  • Loading branch information
jalil-salame committed Oct 19, 2024
1 parent c108e1c commit fc77030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc77030

Please sign in to comment.