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 integer logarithms #103570

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Conversation

lukas-code
Copy link
Member

@lukas-code lukas-code commented Oct 26, 2022

Stabilizes feature int_log.

I've also made the functions const stable, because they don't depend on any unstable const features. rustc_allow_const_fn_unstable is just there for Option::expect, which could be replaced with a match and panic!. cc @rust-lang/wg-const-eval

closes #70887 (tracking issue)

blocked on FCP finishing: #70887 (comment)
FCP finished: #70887 (comment)

@rustbot rustbot added T-libs Relevant to the library team, which will review and decide on the PR/issue. relnotes Marks issues that should be documented in the release notes of the next release. labels Oct 26, 2022
Copy link
Member

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

This still needs to be bumped to include the right rustc version, etc. as the FCP is still in progress - but overall it looks good to me!

@@ -2271,15 +2271,16 @@ macro_rules! int_impl {
/// # Panics
///
/// This function will panic if `self` is less than or equal to zero,
/// or if `base` is less then 2.
/// or if `base` is less than 2.
Copy link
Member

Choose a reason for hiding this comment

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

hah, nice catch!

@scottmcm
Copy link
Member

bumped to include the right rustc version, etc.

Good news -- that's no longer needed! The magic constant does the right thing, regardless of when this finally ends up landing.

@scottmcm scottmcm self-assigned this Oct 28, 2022
@yoshuawuyts
Copy link
Member

@scottmcm oh amazing - love to see it!

@lukas-code lukas-code marked this pull request as ready for review November 3, 2022 13:49
@rustbot
Copy link
Collaborator

rustbot commented Nov 3, 2022

The Miri subtree was changed

cc @rust-lang/miri

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

#[unstable(feature = "int_log", issue = "70887")]
#[stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")]
#[rustc_allow_const_fn_unstable(const_option)]
Copy link
Member

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 do we already have rustc_allow_const_fn_unstable(const_option) for Option::expect?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, but it seems entirely fine, as worst case we remove it and use manual match at the call sites

@scottmcm scottmcm added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 9, 2022
@scottmcm
Copy link
Member

scottmcm commented Nov 9, 2022

With the FCP complete, this looks good to go! 🎉

@bors r+

@bors
Copy link
Contributor

bors commented Nov 9, 2022

📌 Commit 9e36fd9 has been approved by scottmcm

It is now in the queue for this repository.

@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 Nov 9, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Nov 9, 2022
Stabilize integer logarithms

Stabilizes feature `int_log`.

I've also made the functions const stable, because they don't depend on any unstable const features. `rustc_allow_const_fn_unstable` is just there for `Option::expect`, which could be replaced with a `match` and `panic!`. cc `@rust-lang/wg-const-eval`

closes rust-lang#70887 (tracking issue)

~~blocked on FCP finishing: rust-lang#70887 (comment)
FCP finished: rust-lang#70887 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 9, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#103570 (Stabilize integer logarithms)
 - rust-lang#103694 (Add documentation examples for `pointer::mask`)
 - rust-lang#103919 (Unescaping cleanups)
 - rust-lang#103933 (Promote {aarch64,i686,x86_64}-unknown-uefi to Tier 2)
 - rust-lang#103952 (Don't intra linkcheck reference)
 - rust-lang#104111 (rustdoc: Add mutable to the description)
 - rust-lang#104125 (Const Compare for Tuples)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 9, 2022
Stabilize integer logarithms

Stabilizes feature `int_log`.

I've also made the functions const stable, because they don't depend on any unstable const features. `rustc_allow_const_fn_unstable` is just there for `Option::expect`, which could be replaced with a `match` and `panic!`. cc ```@rust-lang/wg-const-eval```

closes rust-lang#70887 (tracking issue)

~~blocked on FCP finishing: rust-lang#70887 (comment)
FCP finished: rust-lang#70887 (comment)
@bors bors merged commit 1db7f69 into rust-lang:master Nov 9, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 9, 2022
@lukas-code lukas-code deleted the stabilize-ilog branch November 9, 2022 20:15
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
Stabilize integer logarithms

Stabilizes feature `int_log`.

I've also made the functions const stable, because they don't depend on any unstable const features. `rustc_allow_const_fn_unstable` is just there for `Option::expect`, which could be replaced with a `match` and `panic!`. cc ``@rust-lang/wg-const-eval``

closes rust-lang#70887 (tracking issue)

~~blocked on FCP finishing: rust-lang#70887 (comment)
FCP finished: rust-lang#70887 (comment)
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
Rollup of 7 pull requests

Successful merges:

 - rust-lang#103570 (Stabilize integer logarithms)
 - rust-lang#103694 (Add documentation examples for `pointer::mask`)
 - rust-lang#103919 (Unescaping cleanups)
 - rust-lang#103933 (Promote {aarch64,i686,x86_64}-unknown-uefi to Tier 2)
 - rust-lang#103952 (Don't intra linkcheck reference)
 - rust-lang#104111 (rustdoc: Add mutable to the description)
 - rust-lang#104125 (Const Compare for Tuples)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Tracking Issue for Integer::{ilog,ilog2,ilog10}
7 participants