-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Tracking Issue for fn const BuildHasherDefault::new() #123197
Comments
…ew, r=Amanieu Add fn const BuildHasherDefault::new See [tracking issue](rust-lang#123197) for justification.
…ew, r=Amanieu Add fn const BuildHasherDefault::new See [tracking issue](rust-lang#123197) for justification.
Rollup merge of rust-lang#123198 - krtab:build_hasher_default_const_new, r=Amanieu Add fn const BuildHasherDefault::new See [tracking issue](rust-lang#123197) for justification.
better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc `@rust-lang/libs-api` `@rust-lang/wg-const-eval` Closes rust-lang#104061 Related to rust-lang#102575
better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc ``@rust-lang/libs-api`` ``@rust-lang/wg-const-eval`` Closes rust-lang#104061 Related to rust-lang#102575
better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc ```@rust-lang/libs-api``` ```@rust-lang/wg-const-eval``` Closes rust-lang#104061 Related to rust-lang#102575
better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc `@rust-lang/libs-api` `@rust-lang/wg-const-eval` Closes rust-lang#104061 Related to rust-lang#102575
better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc ``@rust-lang/libs-api`` ``@rust-lang/wg-const-eval`` Closes rust-lang#104061 Related to rust-lang#102575
Rollup merge of rust-lang#132503 - RalfJung:const-hash-map, r=Amanieu better test for const HashMap; remove const_hash leftovers The existing `const_with_hasher` test is kind of silly since the HashMap it constructs can never contain any elements. So this adjusts the test to construct a usable HashMap, which is a bit non-trivial since the default hash builder cannot be built in `const`. `BuildHasherDefault::new()` helps but is unstable (rust-lang#123197), so we also have a test that does not involve that type. The second commit removes the last remnants of rust-lang#104061, since they aren't actually useful -- without const traits, you can't do any hashing in `const`. Cc ``@rust-lang/libs-api`` ``@rust-lang/wg-const-eval`` Closes rust-lang#104061 Related to rust-lang#102575
@rust-lang/libs-api with #132541 on its way into the compiler, we are quite close to stabilizing #102575. However, actually creating a struct MyBuildDefaultHasher;
impl BuildHasher for MyBuildDefaultHasher {
type Hasher = DefaultHasher;
fn build_hasher(&self) -> Self::Hasher {
DefaultHasher::new()
}
}
const H: HashMap<(), (), MyBuildDefaultHasher> = HashMap::with_hasher(MyBuildDefaultHasher); So, I propose that we also stabilize const H: HashMap<(), (), BuildHasherDefault<DefaultHasher>> =
HashMap::with_hasher(BuildHasherDefault::new()); |
Cc @rust-lang/wg-const-eval |
@rfcbot merge |
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Rollup merge of rust-lang#133696 - RalfJung:const-hashmap, r=cuviper stabilize const_collections_with_hasher and build_hasher_default_const_new After a lot of preparatory work, finally we can stabilize creating `HashMap` in const context. :) FCP for const_collections_with_hasher passed in rust-lang#102575. Fixes rust-lang#102575. FCP for build_hasher_default_const_new passed in rust-lang#123197. Fixes rust-lang#123197. Cc `@Amanieu` Release notes: rust-lang#133347
stabilize const_collections_with_hasher and build_hasher_default_const_new After a lot of preparatory work, finally we can stabilize creating `HashMap` in const context. :) FCP for const_collections_with_hasher passed in rust-lang/rust#102575. Fixes rust-lang/rust#102575. FCP for build_hasher_default_const_new passed in rust-lang/rust#123197. Fixes rust-lang/rust#123197. Cc `@Amanieu` Release notes: rust-lang/rust#133347
Feature gate:
#![feature(build_hasher_default_const_new)]
This is a tracking issue for a new
new
class method for BuildHasherDefault. It allows creating a BuildHasherDefault in const contexts.Because HashMap::with_hasher constness is being stabilized in #118427 this will in turn allow creating empty
HashMap<K,V,BuildHasherDefault<H>>
in const context for anyH: Default + Hasher
.Public API
Steps / History
Unresolved Questions
@rustbot claim
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: