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 const_float_bits_conv #129555

Merged
merged 1 commit into from
Sep 8, 2024
Merged

Conversation

RalfJung
Copy link
Member

This stabilizes const_float_bits_conv, and thus fixes #72447. With #128596 having landed, this is entirely a libs-only question now.

impl f32 {
    pub const fn to_bits(self) -> u32;
    pub const fn from_bits(v: u32) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 4];
    pub const fn to_le_bytes(self) -> [u8; 4]
    pub const fn to_ne_bytes(self) -> [u8; 4];
    pub const fn from_be_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self;
}

impl f64 {
    pub const fn to_bits(self) -> u64;
    pub const fn from_bits(v: u64) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 8];
    pub const fn to_le_bytes(self) -> [u8; 8]
    pub const fn to_ne_bytes(self) -> [u8; 8];
    pub const fn from_be_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self;
}

Cc @rust-lang/wg-const-eval @rust-lang/libs-api

@rustbot
Copy link
Collaborator

rustbot commented Aug 25, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 25, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@RalfJung RalfJung added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Aug 25, 2024
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the const_float_bits_conv branch 3 times, most recently from 89d09af to 9ec4bdc Compare August 26, 2024 08:53
@Amanieu Amanieu added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Aug 27, 2024
@Amanieu
Copy link
Member

Amanieu commented Aug 27, 2024

This seems fine from the libs-api side, as long as wg-const-eval is happy with it.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Aug 27, 2024

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. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Aug 27, 2024
@rfcbot
Copy link

rfcbot commented Aug 28, 2024

🔔 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 Aug 28, 2024
@RalfJung RalfJung force-pushed the const_float_bits_conv branch 2 times, most recently from 961ae3f to 45ca7fa Compare September 1, 2024 09:59
@rust-log-analyzer

This comment has been minimized.

@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 7, 2024
@rfcbot
Copy link

rfcbot commented Sep 7, 2024

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.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Sep 7, 2024
@RalfJung
Copy link
Member Author

RalfJung commented Sep 7, 2024

@Amanieu can I take your comment above as "r=me once FCP passes"?

Otherwise, @Mark-Simulacrum this is now in your court. :)

@dtolnay
Copy link
Member

dtolnay commented Sep 7, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 7, 2024

📌 Commit 19908ff has been approved by dtolnay

It is now in the queue for this repository.

@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 Sep 7, 2024
@dtolnay dtolnay assigned dtolnay and unassigned Mark-Simulacrum Sep 7, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 7, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#126452 (Implement raw lifetimes and labels (`'r#ident`))
 - rust-lang#129555 (stabilize const_float_bits_conv)
 - rust-lang#129594 (explain the options bootstrap passes to curl)
 - rust-lang#129677 (Don't build by-move body when async closure is tainted)
 - rust-lang#129847 (Do not call query to compute coroutine layout for synthetic body of async closure)
 - rust-lang#129869 (add a few more crashtests)
 - rust-lang#130009 (rustdoc-search: allow trailing `Foo ->` arg search)
 - rust-lang#130046 (str: make as_mut_ptr and as_bytes_mut unstably const)
 - rust-lang#130047 (Win: Add dbghelp to the list of import libraries)
 - rust-lang#130059 (Remove the unused  `llvm-skip-rebuild` option from x.py)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3b2139b into rust-lang:master Sep 8, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 8, 2024
Rollup merge of rust-lang#129555 - RalfJung:const_float_bits_conv, r=dtolnay

stabilize const_float_bits_conv

This stabilizes `const_float_bits_conv`, and thus fixes rust-lang#72447. With rust-lang#128596 having landed, this is entirely a libs-only question now.

```rust
impl f32 {
    pub const fn to_bits(self) -> u32;
    pub const fn from_bits(v: u32) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 4];
    pub const fn to_le_bytes(self) -> [u8; 4]
    pub const fn to_ne_bytes(self) -> [u8; 4];
    pub const fn from_be_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self;
}

impl f64 {
    pub const fn to_bits(self) -> u64;
    pub const fn from_bits(v: u64) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 8];
    pub const fn to_le_bytes(self) -> [u8; 8]
    pub const fn to_ne_bytes(self) -> [u8; 8];
    pub const fn from_be_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self;
}
````

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
@RalfJung RalfJung deleted the const_float_bits_conv branch September 9, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for #![feature(const_float_bits_conv)]
10 participants