-
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
Tracking Issue for const_btree_len #71835
Comments
Constantify more BTreeMap and BTreeSet functions Just because we can: - `BTreeMap::len` - `BTreeMap::is_empty` - `BTreeSet::len` - `BTreeSet::is_empty` Note that I put the `const` under `const_btree_new`, because I don't think their is a need to create another feature flag for that. cc rust-lang#71835
Constantify more BTreeMap and BTreeSet functions Just because we can: - `BTreeMap::len` - `BTreeMap::is_empty` - `BTreeSet::len` - `BTreeSet::is_empty` Note that I put the `const` under `const_btree_new`, because I don't think their is a need to create another feature flag for that. cc rust-lang#71835
Can the following functions be added to the top statement ?
|
BTreeMap::new()
and BTreeSet::new()
const functionsBTreeMap
functions
BTreeMap
functions{BTreeMap,Set}
functions
@jonas-schievink @JohnTitor , could you please start FCP? |
What's the state of this? |
cc @rust-lang/libs-api --^ |
I'm 100% in favor of making So I'm starting an FCP just for constifying the @rfcbot fcp merge |
Team member @Amanieu 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 seemed wrong to me, so I looked it up. Apparently the ¹ so |
Actually a very good reason, if I recall correctly. |
🔔 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. |
…lacrum Stabilize const `BTree{Map,Set}::new` The FCP was completed in rust-lang#71835. Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
…lacrum Stabilize const `BTree{Map,Set}::new` The FCP was completed in rust-lang#71835. Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
…lacrum Stabilize const `BTree{Map,Set}::new` The FCP was completed in rust-lang#71835. Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
This was stabilized in 1.66. |
Actually |
Ah, sorry about that. |
Hello all. This looks interesting, but is it possible to create a const BTreeMap with data? As far as I can see, |
No, that depends on #79597, which doesn't even have an experimental implementation yet AFAIK. |
Thanks for the info and pointer, @jplatte . |
I do wonder why this is ties to heap allocation though. A const, immutable BTree map would not have to live on the heap. I guess my mental model of const mem = a heap computed at compile time and immutable thereafter is wrong. |
This is about the heap emulation during compile time. We need to figure out some way to store the data while doing const evaluation |
{BTreeMap,Set}
functions
This tracks stabilization of the
const_btree_len
feature, which allows calling the below in a constant expression:BTree{Map,Set}::{len,is_empty}()
(Constantify more BTreeMap and BTreeSet functions #78581)Previously tracked here, already stable
BTree{Map,Set}::new()
(Make BTreeMap::new and BTreeSet::new const #71839)Steps
The text was updated successfully, but these errors were encountered: