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 duration_consts_float #131289

Merged
merged 1 commit into from
Oct 12, 2024
Merged

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Oct 5, 2024

Waiting for FCP in #72440 to pass.

as_millis_f32 and as_millis_f64 are not stable at all yet, so I moved their const-stability together with their regular stability (tracked at #122451).

Fixes #72440

@rustbot
Copy link
Collaborator

rustbot commented Oct 5, 2024

r? @cuviper

rustbot has assigned @cuviper.
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-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 5, 2024
@bors
Copy link
Contributor

bors commented Oct 5, 2024

☔ The latest upstream changes (presumably #131288) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member Author

FCP passed, so @cuviper this should be ready to land. :)

I'll resolve the conflicts.

@tgross35
Copy link
Contributor

This PR const stabilizes the following functions, which are already stable:

impl Duration {
    pub const fn as_secs_f64(&self) -> f64;
    pub const fn as_secs_f32(&self) -> f32;
    pub const fn div_duration_f64(self, rhs: Duration) -> f64;
    pub const fn div_duration_f32(self, rhs: Duration) -> f32;
}

These just rely on const_fn_floating_point_arithmetic which was merged recently. FCP completed at #72440 (comment).

The remaining functions are still not stable so the const gate was changed to duration_consts_float:

impl Duration {
    pub const fn as_millis_f64(&self) -> f64;
    pub const fn as_millis_f32(&self) -> f32;
}

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2024

📌 Commit 181e667 has been approved by tgross35

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 Oct 11, 2024
@tgross35 tgross35 assigned tgross35 and unassigned cuviper Oct 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics)
 - rust-lang#130962 (Migrate lib's `&Option<T>` into `Option<&T>`)
 - rust-lang#131289 (stabilize duration_consts_float)
 - rust-lang#131310 (Support clobber_abi in MSP430 inline assembly)
 - rust-lang#131546 (Make unused_parens's suggestion considering expr's attributes.)
 - rust-lang#131565 (Remove deprecation note in the `non_local_definitions` lint)
 - rust-lang#131576 (Flatten redundant test module `run_make_support::diff::tests::tests`)

r? `@ghost`
`@rustbot` modify labels: rollup
@RalfJung
Copy link
Member Author

The remaining functions are still not stable so the const gate was changed to duration_consts_float:

Correction, it was changed to duration_millis_float -- the gate that also governs calling them from non-const code.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics)
 - rust-lang#130962 (Migrate lib's `&Option<T>` into `Option<&T>`)
 - rust-lang#131289 (stabilize duration_consts_float)
 - rust-lang#131310 (Support clobber_abi in MSP430 inline assembly)
 - rust-lang#131546 (Make unused_parens's suggestion considering expr's attributes.)
 - rust-lang#131565 (Remove deprecation note in the `non_local_definitions` lint)
 - rust-lang#131576 (Flatten redundant test module `run_make_support::diff::tests::tests`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3e16b77 into rust-lang:master Oct 12, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
Rollup merge of rust-lang#131289 - RalfJung:duration_consts_float, r=tgross35

stabilize duration_consts_float

Waiting for FCP in rust-lang#72440 to pass.

`as_millis_f32` and `as_millis_f64` are not stable at all yet, so I moved their const-stability together with their regular stability (tracked at rust-lang#122451).

Fixes rust-lang#72440
@RalfJung RalfJung deleted the duration_consts_float branch October 13, 2024 07:38
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-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 constify-ing non-trait Duration methods
5 participants