-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
HashMap is UnwindSafe #62304
HashMap is UnwindSafe #62304
Conversation
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
@rust-lang/release, is there time to squeeze this into 1.36.0? |
Most likely no, but I'm reaching out to folks and will try to update here if we decide to go ahead. |
src/libstd/panic.rs
Outdated
@@ -285,6 +286,12 @@ impl RefUnwindSafe for atomic::AtomicBool {} | |||
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")] | |||
impl<T> RefUnwindSafe for atomic::AtomicPtr<T> {} | |||
|
|||
// https://github.com/rust-lang/rust/issues/62301 | |||
#[stable(feature = "hashbrown", since = "1.36.0")] | |||
impl<K, V, S> UnwindSafe for collections::HashMap<K, V, S> where K: UnwindSafe, V: UnwindSafe {} |
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.
Should there be any constraint on S
?
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.
Indeed.
src/libstd/panic.rs
Outdated
#[stable(feature = "hashbrown", since = "1.36.0")] | ||
impl<K, V, S> UnwindSafe for collections::HashMap<K, V, S> where K: UnwindSafe, V: UnwindSafe {} | ||
#[stable(feature = "hashbrown", since = "1.36.0")] | ||
impl<T, S> UnwindSafe for collections::HashSet<T, S> where T: UnwindSafe {} |
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.
I would expect the set's impl to be automatic from the map's, but that deserves a test.
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.
Oh, I was expected std::collections::HashSet
to be based on hashbrown::HashSet
but it’s not. It’s based on std::collections::HashMap
, so you’re right.
Ideally this would be in hashbrown itself, but hashbrown is |
Fixes rust-lang#62301, a regression in 1.36.0 which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
We've decided that we probably can go ahead with a stable CI build; I want this r+-ed before we go ahead fully though. I'll start preparing a stable-targeting PR in an hour or so. |
This seems good enough, we can change how we do this later, as long as @bors r+ |
📌 Commit 7454b29 has been approved by |
HashMap is UnwindSafe Fixes rust-lang#62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
HashMap is UnwindSafe Fixes rust-lang#62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
Rollup of 15 pull requests Successful merges: - #62021 (MSVC link output improve) - #62064 (nth_back for chunks_exact) - #62128 (Adjust warning of -C extra-filename with -o.) - #62161 (Add missing links for TryFrom docs) - #62183 (std: Move a process test out of libstd) - #62186 (Add missing type urls in Into trait) - #62196 (Add Vec::leak) - #62199 (import gdb for explicit access to gdb.current_objfile()) - #62229 (Enable intptrcast for explicit casts) - #62250 (Improve box clone doctests to ensure the documentation is valid) - #62255 (Switch tracking issue for `#![feature(slice_patterns)]`) - #62285 (Fix michaelwoerister's mailmap) - #62304 (HashMap is UnwindSafe) - #62319 (Fix mismatching Kleene operators) - #62327 (Fixed document bug, those replaced each other) Failed merges: r? @ghost
Already backported. |
@rust-lang/libs -- as a process note, we backported this fix to beta and stable already, but I don't think it went through official confirmation by y'all, so just pinging you to make sure it doesn't get lost |
Fixes #62301, a regression in 1.36.0-pre which was caused by hashbrown using
NonZero<T>
where the older hashmap usedUnique<T>
.