-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use same FxHashMap
in rustdoc-json-types
and librustdoc
.
#110051
Conversation
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi These commits modify the If this was intentional then you can ignore this comment. |
Hmm, I thought the motivation was that you want to be able to auto publish rustdoc-json-types to crates.io so people can use it? Is jsondocck built with the beta compiler or something like that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 this looks good, thanks! r=me when CI passes
Yeah, tools arn't allowed to use nightly features (Not sure if build with beta, but it's enforced with
I already do this (but not automaticly, and not in an official capacity) with aDotInTheVoid/rustdoc-types. This happens to make that slightly simpler, but wasn't the motivation (rust-lang/rustdoc-types#22) |
This bit means it's built with beta :) @bors r+ rollup |
Use same `FxHashMap` in `rustdoc-json-types` and `librustdoc`. The original motivation was me trying to remove the `#![allow(rustc::default_hash_types)]`, as after rust-lang#108626, we should be using `FxHashMap` here. I then realized I should also be able to remove the `.into_iter().collect()`, as we no longer need to convert from `FxHashMap` to `std::HashMap`. However, this didn't work, and I got the following error ``` error[E0308]: mismatched types --> src/librustdoc/json/mod.rs:235:13 | 235 | index, | ^^^^^ expected `rustc_hash::FxHasher`, found `FxHasher` | = note: `FxHasher` and `rustc_hash::FxHasher` have similar names, but are actually distinct types note: `FxHasher` is defined in crate `rustc_hash` --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-hash-1.1.0/src/lib.rs:60:1 note: `rustc_hash::FxHasher` is defined in crate `rustc_hash` --> /home/alona/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-hash-1.1.0/src/lib.rs:60:1 | 60 | pub struct FxHasher { | ^^^^^^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `rustc_hash` are being used? ``` This is because `librustdoc` got it's `FxHashMap` via the sysroot `rustc-data-strucures`, whereas `rustdoc-json-types` got it via `rustc-hash` on crates.io. To avoid this, `rustdoc-json-types` now uses `#![feature(rustc_private)]` to load the same version as `librustdoc`. However, this needs to be placed behind a feature, as `rustdoc-json-types` is also dependency of `src/tools/jsondocck`, which means need needs to be buildable without nightly features. r? `@jyn514`
12ad0d6
to
1410337
Compare
Running @bors try |
⌛ Trying commit 1410337 with merge 45fa4ef132fa25eaff3a9b6d127746c25f1c7e4d... |
☀️ Try build successful - checks-actions |
@bors r=jyn514 |
⌛ Testing commit 1410337 with merge e56d2f3fdfca65541fab42024effb381d393ebf2... |
@rustbot author |
9888da7
to
06cb136
Compare
This comment has been minimized.
This comment has been minimized.
06cb136
to
2b7820b
Compare
@bors try |
This comment has been minimized.
This comment has been minimized.
2b7820b
to
20a41fb
Compare
This comment has been minimized.
This comment has been minimized.
20a41fb
to
c36aa67
Compare
@bors ping |
Use same `FxHashMap` in `rustdoc-json-types` and `librustdoc`. Reopening of rust-lang#110051, because bors has seemingly abandoned us there :'( `@bors` try r? `@ghost`
@bors ping |
😪 I'm awake I'm awake |
uh, this is marked as pending, blocking CI from making progress. |
Use same `FxHashMap` in `rustdoc-json-types` and `librustdoc`. Reopening of rust-lang#110051, because bors has seemingly abandoned us there :'( try-job: dist-arm-linux try-job: dist-armhf-linux try-job: armhf-gnu try-job: test-various r? `@ghost`
rustdoc-json: Use FxHashMap from rustdoc_json_types Alternative to rust-lang#110051 and rust-lang#127456. This lets us avoid rehashing the json index after building it by using the same hashmap type in construction and in rustdoc_json_types. The above PR's tried to do this by having rustdoc_json_types get the same hashmap that rustdoc has via rustc_data_structures. However, this can be made simpler if we change rustdoc instead. For the rustdoc-type republish on crates.io, I'll filter out the `pub use`, and not change the API at all. That code [already replaces the hashmap](https://github.com/aDotInTheVoid/rustdoc-types/blob/8d6528669ec64c2af43d1c79a228b7711cefdad7/update.sh#L11) to use the one in `std::collections` (instead of `FxHashMap`) try-job: dist-arm-linux r? `@GuillaumeGomez`
…llaumeGomez rustdoc-json: Use FxHashMap from rustdoc_json_types Alternative to rust-lang#110051 and rust-lang#127456. This lets us avoid rehashing the json index after building it by using the same hashmap type in construction and in rustdoc_json_types. The above PR's tried to do this by having rustdoc_json_types get the same hashmap that rustdoc has via rustc_data_structures. However, this can be made simpler if we change rustdoc instead. For the rustdoc-type republish on crates.io, It will filter out the `pub use`, and not change source at all. rust-lang/rustdoc-types#30. That code [already replaces the hashmap](https://github.com/aDotInTheVoid/rustdoc-types/blob/8d6528669ec64c2af43d1c79a228b7711cefdad7/update.sh#L11) to use the one in `std::collections` (instead of `FxHashMap`) try-job: dist-arm-linux r? `@GuillaumeGomez`
…llaumeGomez rustdoc-json: Use FxHashMap from rustdoc_json_types Alternative to rust-lang#110051 and rust-lang#127456. This lets us avoid rehashing the json index after building it by using the same hashmap type in construction and in rustdoc_json_types. The above PR's tried to do this by having rustdoc_json_types get the same hashmap that rustdoc has via rustc_data_structures. However, this can be made simpler if we change rustdoc instead. For the rustdoc-type republish on crates.io, It will filter out the `pub use`, and not change source at all. rust-lang/rustdoc-types#30. That code [already replaces the hashmap](https://github.com/aDotInTheVoid/rustdoc-types/blob/8d6528669ec64c2af43d1c79a228b7711cefdad7/update.sh#L11) to use the one in `std::collections` (instead of `FxHashMap`) try-job: dist-arm-linux r? ``@GuillaumeGomez``
Rollup merge of rust-lang#129124 - aDotInTheVoid:rdj-hashmap-3, r=GuillaumeGomez rustdoc-json: Use FxHashMap from rustdoc_json_types Alternative to rust-lang#110051 and rust-lang#127456. This lets us avoid rehashing the json index after building it by using the same hashmap type in construction and in rustdoc_json_types. The above PR's tried to do this by having rustdoc_json_types get the same hashmap that rustdoc has via rustc_data_structures. However, this can be made simpler if we change rustdoc instead. For the rustdoc-type republish on crates.io, It will filter out the `pub use`, and not change source at all. rust-lang/rustdoc-types#30. That code [already replaces the hashmap](https://github.com/aDotInTheVoid/rustdoc-types/blob/8d6528669ec64c2af43d1c79a228b7711cefdad7/update.sh#L11) to use the one in `std::collections` (instead of `FxHashMap`) try-job: dist-arm-linux r? ``@GuillaumeGomez``
The original motivation was me trying to remove the
#![allow(rustc::default_hash_types)]
, as after #108626, we should be usingFxHashMap
here. I then realized I should also be able to remove the.into_iter().collect()
, as we no longer need to convert fromFxHashMap
tostd::HashMap
.However, this didn't work, and I got the following error
This is because
librustdoc
got it'sFxHashMap
via the sysrootrustc-data-strucures
, whereasrustdoc-json-types
got it viarustc-hash
on crates.io.To avoid this,
rustdoc-json-types
now uses#![feature(rustc_private)]
to load the same version aslibrustdoc
.However, this needs to be placed behind a feature, as
rustdoc-json-types
is also dependency ofsrc/tools/jsondocck
, which means need needs to be buildable without nightly features.r? @jyn514