Skip to content

Make some Ordering methods const #76198

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

Merged
merged 2 commits into from
Sep 16, 2020
Merged

Make some Ordering methods const #76198

merged 2 commits into from
Sep 16, 2020

Conversation

CDirkx
Copy link
Contributor

@CDirkx CDirkx commented Sep 1, 2020

Resubmission of PR#75463 as per PR#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 #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: #76113

Constify the following methods of `core::cmp::Ordering`:
 - `reverse`
 - `then`

Stabilizes these methods as const under the `const_ordering` feature.
Also adds a test for these methods in a const context.

Possible because of rust-lang#49146 (Allow `if` and `match` in constants).
@rust-highfive
Copy link
Contributor

r? @withoutboats

(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 Sep 1, 2020
@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2020

Thanks. :)
@rust-lang/libs can someone start FCP, assuming that's you usual process for stabilization?

@RalfJung RalfJung added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 1, 2020
@Amanieu
Copy link
Member

Amanieu commented Sep 1, 2020

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Sep 1, 2020

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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Sep 1, 2020
@LukasKalbertodt
Copy link
Member

CC @rust-lang/wg-const-eval

@CDirkx
Copy link
Contributor Author

CDirkx commented Sep 3, 2020

As pointed out by @matklad on a similar PR, the tests are moved to library\core.
See issue #76268

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Sep 4, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Sep 4, 2020

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Sep 4, 2020
@jonas-schievink jonas-schievink added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 13, 2020
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 14, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Sep 14, 2020

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.

The RFC will be merged soon.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Sep 14, 2020
@dtolnay
Copy link
Member

dtolnay commented Sep 15, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 15, 2020

📌 Commit 79d563c has been approved by dtolnay

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 15, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 15, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#73955 (deny(unsafe_op_in_unsafe_fn) in libstd/process.rs)
 - rust-lang#75146 (Detect overflow in proc_macro_server subspan)
 - rust-lang#75304 (Note when a a move/borrow error is caused by a deref coercion)
 - rust-lang#75749 (Consolidate some duplicate code in the sys modules.)
 - rust-lang#75882 (Use translated variable for test string)
 - rust-lang#75886 (Test that bounds checks are elided for [..index] after .position())
 - rust-lang#76048 (Initial support for riscv32gc_unknown_linux_gnu)
 - rust-lang#76198 (Make some Ordering methods const)
 - rust-lang#76689 (Upgrade to pulldown-cmark 0.8.0)
 - rust-lang#76763 (Update cargo)

Failed merges:

r? `@ghost`
@bors bors merged commit 69ac076 into rust-lang:master Sep 16, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 16, 2020
@spastorino spastorino removed the to-announce Announce this issue on triage meeting label Sep 16, 2020
@CDirkx CDirkx deleted the const-ordering branch September 18, 2020 17:35
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 7, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 8, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Nov 8, 2020
Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2020
Stabilize `IpAddr::is_ipv4` and `is_ipv6` as const

Insta-stabilize the methods `is_ipv4` and `is_ipv6` of `std::net::IpAddr` as const, in the same way as [PR#76198](rust-lang#76198).

Possible because of the recent stabilization of const control flow.

Part of rust-lang#76225 and rust-lang#76205.
@dtolnay dtolnay assigned dtolnay and unassigned withoutboats Mar 24, 2024
@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.