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_methods #133389

Merged
merged 1 commit into from
Nov 24, 2024

Conversation

eduardosm
Copy link
Contributor

@eduardosm eduardosm commented Nov 23, 2024

Tracking issue: #130843
Relnotes: #133383

Stabilized const API:

// in `core`
impl f32/f64 {
    pub const fn recip(self) -> Self;
    pub const fn to_degrees(self) -> Self;
    pub const fn to_radians(self) -> Self;
    pub const fn max(self, other: Self) -> Self;
    pub const fn min(self, other: Self) -> Self;
    pub const fn clamp(self, min: Self, max: Self) -> Self;
    pub const fn abs(self) -> Self;
    pub const fn signum(self) -> Self;
    pub const fn copysign(self, sign: Self) -> Self;
}

Closes #130843

r? libs-api

cc @RalfJung -- I think the way const-stability attributes work have change a bit since the last time a wrote a const-stabilization PR, please make sure I got them right.

@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 Nov 23, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2024

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @rust-lang/wg-const-eval

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cc @rust-lang/wg-const-eval

bootstrap,
rustc_const_stable(feature = "const_float_methods", since = "CURRENT_RUSTC_VERSION")
)]
#[cfg_attr(not(bootstrap), rustc_intrinsic_const_stable_indirect)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These intrinsics have been approved by t-lang FCP here.

library/core/src/num/f128.rs Show resolved Hide resolved
library/core/src/num/f16.rs Show resolved Hide resolved
library/core/src/num/f32.rs Show resolved Hide resolved
library/core/src/num/f16.rs Show resolved Hide resolved
@RalfJung
Copy link
Member

Looks good, thanks. :)

@bors r+ rollup
(Given that this passed t-libs-api FCP, I don't think we need the reviewer to also be in t-libs-api.)

@bors
Copy link
Contributor

bors commented Nov 23, 2024

📌 Commit 6f7dc38 has been approved by RalfJung

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 Nov 23, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#133300 (inject_panic_runtime(): Avoid double negation for 'any non rlib')
 - rust-lang#133301 (Add code example for `wrapping_neg` method for signed integers)
 - rust-lang#133371 (remove is_trivially_const_drop)
 - rust-lang#133389 (Stabilize `const_float_methods`)
 - rust-lang#133398 (rustdoc: do not call to_string, it's already impl Display)
 - rust-lang#133405 (tidy: Distinguish between two different meanings of "style file")

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 220251e into rust-lang:master Nov 24, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 24, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2024
Rollup merge of rust-lang#133389 - eduardosm:stabilize-const_float_methods, r=RalfJung

Stabilize `const_float_methods`

Tracking issue: rust-lang#130843
Relnotes: rust-lang#133383

Stabilized const API:

```rust
// in `core`
impl f32/f64 {
    pub const fn recip(self) -> Self;
    pub const fn to_degrees(self) -> Self;
    pub const fn to_radians(self) -> Self;
    pub const fn max(self, other: Self) -> Self;
    pub const fn min(self, other: Self) -> Self;
    pub const fn clamp(self, min: Self, max: Self) -> Self;
    pub const fn abs(self) -> Self;
    pub const fn signum(self) -> Self;
    pub const fn copysign(self, sign: Self) -> Self;
}
```

Closes rust-lang#130843

r? libs-api

cc `@RalfJung` -- I think the way const-stability attributes work have change a bit since the last time a wrote a const-stabilization PR, please make sure I got them right.
@eduardosm eduardosm deleted the stabilize-const_float_methods branch November 24, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking Issue for #![feature(const_float_methods)]
5 participants