-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Stabilize integer logarithms #103570
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hah, nice catch!
Good news -- that's no longer needed! The magic constant does the right thing, regardless of when this finally ends up landing. |
@scottmcm oh amazing - love to see it! |
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 Examples of
|
#[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)] |
There was a problem hiding this 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 do we already have rustc_allow_const_fn_unstable(const_option)
for Option::expect
?
There was a problem hiding this comment.
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
With the FCP complete, this looks good to go! 🎉 @bors r+ |
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)
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
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)
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)
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
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 forOption::expect
, which could be replaced with amatch
andpanic!
. cc @rust-lang/wg-const-evalcloses #70887 (tracking issue)
blocked on FCP finishing: #70887 (comment)FCP finished: #70887 (comment)