Skip to content
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

Merged
merged 1 commit into from
Jul 3, 2019
Merged

HashMap is UnwindSafe #62304

merged 1 commit into from
Jul 3, 2019

Conversation

SimonSapin
Copy link
Contributor

Fixes #62301, a regression in 1.36.0-pre which was caused by hashbrown using NonZero<T> where the older hashmap used Unique<T>.

@SimonSapin SimonSapin added A-collections Area: `std::collection` beta-nominated Nominated for backporting to the compiler in the beta channel. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Jul 2, 2019
@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 2, 2019
@SimonSapin
Copy link
Contributor Author

@rust-lang/release, is there time to squeeze this into 1.36.0?

@Mark-Simulacrum
Copy link
Member

Most likely no, but I'm reaching out to folks and will try to update here if we decide to go ahead.

@@ -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 {}
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed.

#[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 {}
Copy link
Member

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.

Copy link
Contributor Author

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.

@SimonSapin
Copy link
Contributor Author

Ideally this would be in hashbrown itself, but hashbrown is #![no_std] and UnwindSafe is defined in libstd.

@kennytm
Copy link
Member

kennytm commented Jul 2, 2019

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned kennytm Jul 2, 2019
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>`.
@Mark-Simulacrum
Copy link
Member

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.

@eddyb
Copy link
Member

eddyb commented Jul 2, 2019

This seems good enough, we can change how we do this later, as long as HashMap remains UnwindSafe.

@bors r+

@bors
Copy link
Contributor

bors commented Jul 2, 2019

📌 Commit 7454b29 has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2019
@jonas-schievink jonas-schievink added stable-nominated Nominated for backporting to the compiler in the stable channel. T-release Relevant to the release subteam, which will review and decide on the PR/issue. labels Jul 2, 2019
@Mark-Simulacrum Mark-Simulacrum removed stable-nominated Nominated for backporting to the compiler in the stable channel. stable-accepted Accepted for backporting to the compiler in the stable channel. labels Jul 2, 2019
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 3, 2019
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>`.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Jul 3, 2019
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>`.
bors added a commit that referenced this pull request Jul 3, 2019
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
@bors bors merged commit 7454b29 into rust-lang:master Jul 3, 2019
@pietroalbini pietroalbini added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jul 9, 2019
@pietroalbini
Copy link
Member

Already backported.

@Mark-Simulacrum
Copy link
Member

@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

@SimonSapin SimonSapin deleted the safe branch July 10, 2019 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: `std::collection` beta-accepted Accepted for backporting to the compiler in the beta channel. regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.36 changes the UnwindSafe impl precondition for HashMap
10 participants