-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
/// | ||
/// # Examples | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".ilog(5), 1);")] | ||
/// ``` | ||
#[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 commentThe reason will be displayed to describe this comment to others. Learn more. Cc @rust-lang/wg-const-eval do we already have There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
@@ -2298,10 +2299,11 @@ macro_rules! int_impl { | |
/// # Examples | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(2", stringify!($SelfT), ".ilog2(), 1);")] | ||
/// ``` | ||
#[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)] | ||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
@@ -2319,10 +2321,11 @@ macro_rules! int_impl { | |
/// # Example | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".ilog10(), 1);")] | ||
/// ``` | ||
#[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)] | ||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
@@ -2343,10 +2346,10 @@ macro_rules! int_impl { | |
/// # Examples | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_ilog(5), Some(1));")] | ||
/// ``` | ||
#[unstable(feature = "int_log", issue = "70887")] | ||
#[stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[rustc_const_stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
@@ -2379,10 +2382,10 @@ macro_rules! int_impl { | |
/// # Examples | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(2", stringify!($SelfT), ".checked_ilog2(), Some(1));")] | ||
/// ``` | ||
#[unstable(feature = "int_log", issue = "70887")] | ||
#[stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[rustc_const_stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
@@ -2403,10 +2406,10 @@ macro_rules! int_impl { | |
/// # Example | ||
/// | ||
/// ``` | ||
/// #![feature(int_log)] | ||
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".checked_ilog10(), Some(1));")] | ||
/// ``` | ||
#[unstable(feature = "int_log", issue = "70887")] | ||
#[stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[rustc_const_stable(feature = "int_log", since = "CURRENT_RUSTC_VERSION")] | ||
#[must_use = "this returns the result of the operation, \ | ||
without modifying the original"] | ||
#[inline] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
//@compile-flags: -Coverflow-checks=off | ||
#![feature(int_log)] | ||
#![allow(arithmetic_overflow)] | ||
|
||
pub fn main() { | ||
|
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!