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

Stabilize alloc::Layout const functions #78305

Merged
merged 1 commit into from
Nov 23, 2020
Merged

Stabilize alloc::Layout const functions #78305

merged 1 commit into from
Nov 23, 2020

Conversation

ChrisDenton
Copy link
Contributor

@ChrisDenton ChrisDenton commented Oct 23, 2020

Stabilizes #67521. In particular the following stable methods are stabilized as const fn:

  • size
  • align
  • from_size_align

Stabilizing size and align should not be controversial as they are simple (usize and NonZeroUsize) fields and I don't think there's any reason to make them not const compatible in the future. That being true, the other methods are trivially const. The only other issue being returning a Result from a const fn but this has been made more usable by recent stabilizations.

@rust-highfive
Copy link
Collaborator

r? @m-ou-se

(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 Oct 23, 2020
@m-ou-se m-ou-se added A-allocators Area: Custom and system allocators A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 23, 2020
@m-ou-se
Copy link
Member

m-ou-se commented Oct 23, 2020

@ChrisDenton Looks like there's still a left over #![feature(const_alloc_layout)] in library/core/src/lib.rs causing the CI to fail. Edit: This was before the force-push.

r? @dtolnay for libs fcp

@rust-highfive rust-highfive assigned dtolnay and unassigned m-ou-se Oct 23, 2020
@ChrisDenton
Copy link
Contributor Author

ChrisDenton commented Oct 23, 2020

Yeah, sorry. In the end I decided to leave the unstable function because I wasn't sure about stabilizing const on it. If it is stabilized I think it should be const but I was uncertain about committing to that in this PR.

EDIT: My goal was to stabilize the minimum of "obviously" guaranteed const functions. I wasn't sure that I should include unstable functions in that.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 6, 2020

cc @rust-lang/wg-const-eval

These seem reasonable to me! But let's make sure the const eval group is on board too. This stabilizes a few accessors on Layout as const.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Nov 6, 2020

Team member @KodrAus 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 Nov 6, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Nov 6, 2020

But let's make sure the const eval group is on board too.

These look fine to me

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

rfcbot commented Nov 12, 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 Nov 12, 2020
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 22, 2020
@rfcbot
Copy link

rfcbot commented Nov 22, 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.

@oli-obk
Copy link
Contributor

oli-obk commented Nov 22, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Nov 22, 2020

📌 Commit 0ba3f4c8551df07253cf757d257743abf3559c76 has been approved by oli-obk

@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 Nov 22, 2020
@bors
Copy link
Contributor

bors commented Nov 22, 2020

⌛ Testing commit 0ba3f4c8551df07253cf757d257743abf3559c76 with merge a10a301e25729da57aaea6643776088fd794b15d...

library/core/src/alloc/layout.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

@bors r- retry

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 22, 2020
@m-ou-se m-ou-se added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 22, 2020
@m-ou-se
Copy link
Member

m-ou-se commented Nov 22, 2020

@ChrisDenton Looks like you accidentally pulled unrelated commits into this PR with a merge commit. Can you rebase/squash instead?

@jyn514
Copy link
Member

jyn514 commented Nov 22, 2020

Stabilizes #67521. In particular the following stable methods are stabilized as const fn:

* size
* align
* from_size_align
@ChrisDenton
Copy link
Contributor Author

It should be fixed now. Thanks!

@m-ou-se
Copy link
Member

m-ou-se commented Nov 22, 2020

@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Nov 22, 2020

📌 Commit 9050d12 has been approved by oli-obk

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 22, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 22, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#76941 (Add f{32,64}::is_subnormal)
 - rust-lang#77697 (Split each iterator adapter and source into individual modules)
 - rust-lang#78305 (Stabilize alloc::Layout const functions)
 - rust-lang#78608 (Stabilize refcell_take)
 - rust-lang#78793 (Clean up `StructuralEq` docs)
 - rust-lang#79267 (BTreeMap: address namespace conflicts)
 - rust-lang#79293 (Add test for eval order for a+=b)
 - rust-lang#79295 (BTreeMap: fix minor testing mistakes in rust-lang#78903)
 - rust-lang#79297 (BTreeMap: swap the names of NodeRef::new and Root::new_leaf)
 - rust-lang#79299 (Stabilise `then`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 186ec64 into rust-lang:master Nov 23, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 23, 2020
@ChrisDenton ChrisDenton deleted the const-layout branch November 23, 2020 03:55
@spastorino spastorino removed the to-announce Announce this issue on triage meeting label Dec 3, 2020
@pthariensflame
Copy link
Contributor

relnotes needed?

@oli-obk oli-obk added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. 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. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. 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.

None yet