-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std: Change hash to reexport its own Writer #14314
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One of the long-term goals of the libstd facade is to move the collections library underneath the standard library. This would imply that libcollections today would invert its dependency with libstd. One of the primary blockers for doing this is the HashMap collection. Of its two major dependencies, hashing and randomness, this commit is the first step in dealing with hashing. When moving the hash module beneath libstd, it must break its primary dependence on the io::Writer trait (used as the hashing state). The proposed strategy for breaking this dependence is taking a similar path as core::fmt, which is to have the hash module define its own "writer trait". This trait would be similar to std::io::Writer, except that it would not return errors and it would have fewer convenience methods. The Hash trait today has its type parameter behind a feature gate (default type parameters), so this pending change will likely break no code which hasn't opted in to the feature gate. The SipState struct will lose its implementation of io::Writer, but it will regain similar methods for dealing with writing data. This change specifically prepares for the hash migration by modifying deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer bound. This bound is currently wired to std::io::Writer, but after a snapshot it will have no need to be wired to the io writer trait.
bors
added a commit
that referenced
this pull request
May 23, 2014
One of the long-term goals of the libstd facade is to move the collections library underneath the standard library. This would imply that libcollections today would invert its dependency with libstd. One of the primary blockers for doing this is the HashMap collection. Of its two major dependencies, hashing and randomness, this commit is the first step in dealing with hashing. When moving the hash module beneath libstd, it must break its primary dependence on the io::Writer trait (used as the hashing state). The proposed strategy for breaking this dependence is taking a similar path as core::fmt, which is to have the hash module define its own "writer trait". This trait would be similar to std::io::Writer, except that it would not return errors and it would have fewer convenience methods. The Hash trait today has its type parameter behind a feature gate (default type parameters), so this pending change will likely break no code which hasn't opted in to the feature gate. The SipState struct will lose its implementation of io::Writer, but it will regain similar methods for dealing with writing data. This change specifically prepares for the hash migration by modifying deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer bound. This bound is currently wired to std::io::Writer, but after a snapshot it will have no need to be wired to the io writer trait.
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Mar 20, 2025
) Closes rust-lang#13306 Closes rust-lang#9925 Closes rust-lang#9470 Closes rust-lang#9305 Clippy gives wrong suggestions when the key is not `Copy`. As suggested in rust-lang#9925, in such cases Clippy will simply warn but no fix. changelog: [`map_entry`]: fix wrong suggestions when key is not `Copy`
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 22, 2025
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 22, 2025
…st-lang#14568) Fixes rust-lang/rust-clippy#14449, introduced in rust-lang#14314 changelog: [`map_entry`]: fix a false positive where the lint would trigger without any insert calls present
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
May 8, 2025
…st-lang#14568) Fixes rust-lang/rust-clippy#14449, introduced in rust-lang#14314 changelog: [`map_entry`]: fix a false positive where the lint would trigger without any insert calls present
bors
pushed a commit
to rust-lang-ci/rust
that referenced
this pull request
May 9, 2025
…st-lang#14568) Fixes rust-lang/rust-clippy#14449, introduced in rust-lang#14314 changelog: [`map_entry`]: fix a false positive where the lint would trigger without any insert calls present
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the long-term goals of the libstd facade is to move the collections
library underneath the standard library. This would imply that libcollections
today would invert its dependency with libstd.
One of the primary blockers for doing this is the HashMap collection. Of its two
major dependencies, hashing and randomness, this commit is the first step in
dealing with hashing.
When moving the hash module beneath libstd, it must break its primary dependence
on the io::Writer trait (used as the hashing state). The proposed strategy for
breaking this dependence is taking a similar path as core::fmt, which is to have
the hash module define its own "writer trait". This trait would be similar to
std::io::Writer, except that it would not return errors and it would have fewer
convenience methods.
The Hash trait today has its type parameter behind a feature gate (default type
parameters), so this pending change will likely break no code which hasn't opted
in to the feature gate. The SipState struct will lose its implementation of
io::Writer, but it will regain similar methods for dealing with writing data.
This change specifically prepares for the hash migration by modifying
deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer
bound. This bound is currently wired to std::io::Writer, but after a snapshot it
will have no need to be wired to the io writer trait.