-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make some Ordering methods const #75463
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Constify the following methods of `core::cmp::Ordering`: - `reverse` - `then` Possible because of rust-lang#49146 (Allow `if` and `match` in constants).
What are the requirements for making functions |
@CDirkx Ping from triage, this needs to get the CI green before review. You'll need to use the |
There's no need for these to be unstable IMO now that |
Yeah that is my question, is it enough that #49146 is stabilized to make these methods |
As I understand it, you're correct and all those methods are eligible for stabilization. (cc @rust-lang/wg-const-eval in case there's an objection). I'll check in with t-libs as well. In the meantime, I'll happily sign off on the insta-stable version. I guess you just keep the current feature name even though it never did anything? |
@bors delegate+ r=me with correct release number (1.46 came out this week). |
✌️ @CDirkx can now approve this pull request |
`const_ordering` will stabilize in version 1.48.0
@bors r+ |
📌 Commit 12f4624 has been approved by |
Make some Ordering methods const Constify the following methods of `core::cmp::Ordering`: - `reverse` - `then` Possible because of rust-lang#49146 (Allow `if` and `match` in constants). Tracking issue: rust-lang#76113
☀️ Test successful - checks-actions, checks-azure |
@rustbot modify labels: T-libs |
Error: Label relnotes can only be set by Rust team members Please let |
Eh, shouldn't there be t-libs FCP on this? I don't think there is precedent for insta-stabilizing new Cc @rust-lang/libs Also @CDirkx, please don't |
@RalfJung Ah, yeah I was unsure if that was the intention. Thanks! |
This was approved by me prematurely. It needs T-libs approval.
…Jung Revert rust-lang#75463 This was approved by me prematurely. It needs T-libs approval. Sorry @CDirkx. r? @RalfJung
Rollup of 12 pull requests Successful merges: - rust-lang#75945 (Use `env::func()`, not 'the function env::func' in docs for std::env) - rust-lang#76002 (Fix `-Z instrument-coverage` on MSVC) - rust-lang#76003 (Adds two source span utility functions used in source-based coverage) - rust-lang#76059 (Clean up E0764) - rust-lang#76103 (Clean up E0769) - rust-lang#76139 (Make `cow_is_borrowed` methods const) - rust-lang#76154 (Fix rustdoc strings indentation) - rust-lang#76161 (Remove notrust in rustc_middle) - rust-lang#76163 (README: Adjust Linux and macOS support platform and architecture) - rust-lang#76166 (Make `StringReader` private) - rust-lang#76172 (Revert rust-lang#75463) - rust-lang#76178 (Update expect-test to 1.0) Failed merges: r? @ghost
Make some Ordering methods const Resubmission of [PR#75463](rust-lang#75463) as per [PR#76172](rust-lang#76172). Constify the following methods of `core::cmp::Ordering`: - `reverse` - `then` Insta-stabilizes these methods as const under the `const_ordering` feature, as their implementation is a trivial match and the recent stabilization of rust-lang#49146 (Allow `if` and `match` in constants). Note: the `const_ordering` feature has never actually been used as these methods have not been `#[rustc_const_unstable]`. Tracking issue: rust-lang#76113
Stabilize some Option methods as const Stabilize the following methods of `Option` as const: - `is_some` - `is_none` - `as_ref` These methods are currently const under the unstable feature `const_option` (tracking issue: rust-lang#67441). I believe these methods to be eligible for stabilization because of the stabilization of rust-lang#49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](rust-lang#75463). Related: rust-lang#76225
Stabilize some Result methods as const Stabilize the following methods of Result as const: - `is_ok` - `is_err` - `as_ref` A test is also included, analogous to the test for `const_option`. These methods are currently const under the unstable feature `const_result` (tracking issue: rust-lang#67520). I believe these methods to be eligible for stabilization because of the stabilization of rust-lang#49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](rust-lang#75463) and [PR#76135](rust-lang#76135). Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature. Related: rust-lang#76225
Stabilize some Option methods as const Stabilize the following methods of `Option` as const: - `is_some` - `is_none` - `as_ref` These methods are currently const under the unstable feature `const_option` (tracking issue: rust-lang#67441). I believe these methods to be eligible for stabilization because of the stabilization of rust-lang#49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](rust-lang#75463). Related: rust-lang#76225
Stabilize some Result methods as const Stabilize the following methods of Result as const: - `is_ok` - `is_err` - `as_ref` A test is also included, analogous to the test for `const_option`. These methods are currently const under the unstable feature `const_result` (tracking issue: #67520). I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](rust-lang/rust#75463) and [PR#76135](rust-lang/rust#76135). Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature. Related: #76225
Constify the following methods of
core::cmp::Ordering
:reverse
then
Possible because of #49146 (Allow
if
andmatch
in constants).Tracking issue: #76113