Skip to content

Derive Hash for Bitv and BitvSet #14749

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

Closed
wants to merge 1 commit into from
Closed

Conversation

sfackler
Copy link
Member

@sfackler sfackler commented Jun 8, 2014

Closes #14744

@@ -672,7 +672,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
/// It should also be noted that the amount of storage necessary for holding a
/// set of objects is proportional to the maximum of the objects when viewed
/// as a `uint`.
#[deriving(Clone)]
#[deriving(Clone, Hash)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct, since it is hashing the underlying storage as well as the semantic value. I think this will mean let x = BitvSet::new(); x.insert(1000); x.remove(1000); hashes differently to just BitvSet::new() even though they are semantically identical (see the implementation of PartialEq).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah

@sfackler
Copy link
Member Author

sfackler commented Jun 8, 2014

@huonw updated. The impl for BitvSet is slower than it could be because I'm not sure there's any guarantee that the BigBitv is as small as possible at all times.

bors added a commit that referenced this pull request Jun 8, 2014
@bors bors closed this Jun 8, 2014
@sfackler sfackler deleted the bitv-hash branch November 26, 2016 05:54
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…=lnicola

feat: define problem matcher for panics in VS Code

Now in VS Code "go to next error" (`F8`) will bring you to the source of a panic.
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitv and BitvSet do not implement Hash
4 participants