Skip to content

Commit

Permalink
Auto merge of #73032 - yoshuawuyts:stabilize-leading_trailing_ones, r…
Browse files Browse the repository at this point in the history
…=Amanieu

stabilize leading_trailing_ones

This PR stabilizes the `leading_trailing_ones` feature. It's been available on nightly since the start of the year, and hasn't had any issues since. It seems unlikely we'll want to change this, so following up on @djc's suggestion in #57969 (comment) I'd like to put forward this PR to stabilize the feature and make it part of `1.46.0`. Thanks!

cc/ @djc @rust-lang/libs
  • Loading branch information
bors committed Jun 29, 2020
2 parents c977b87 + 8bc6b5b commit c86039b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,13 @@ $EndFeature, "
Basic usage:
```
", $Feature, "#![feature(leading_trailing_ones)]
let n = -1", stringify!($SelfT), ";
", $Feature, "let n = -1", stringify!($SelfT), ";
assert_eq!(n.leading_ones(), ", stringify!($BITS), ");",
$EndFeature, "
```"),
#[unstable(feature = "leading_trailing_ones", issue = "57969")]
#[stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[inline]
pub const fn leading_ones(self) -> u32 {
(self as $UnsignedT).leading_ones()
Expand All @@ -478,13 +478,13 @@ $EndFeature, "
Basic usage:
```
", $Feature, "#![feature(leading_trailing_ones)]
let n = 3", stringify!($SelfT), ";
", $Feature, "let n = 3", stringify!($SelfT), ";
assert_eq!(n.trailing_ones(), 2);",
$EndFeature, "
```"),
#[unstable(feature = "leading_trailing_ones", issue = "57969")]
#[stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[inline]
pub const fn trailing_ones(self) -> u32 {
(self as $UnsignedT).trailing_ones()
Expand Down Expand Up @@ -2695,12 +2695,12 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
Basic usage:
```
", $Feature, "#![feature(leading_trailing_ones)]
let n = !(", stringify!($SelfT), "::MAX >> 2);
", $Feature, "let n = !(", stringify!($SelfT), "::MAX >> 2);
assert_eq!(n.leading_ones(), 2);", $EndFeature, "
```"),
#[unstable(feature = "leading_trailing_ones", issue = "57969")]
#[stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[inline]
pub const fn leading_ones(self) -> u32 {
(!self).leading_zeros()
Expand All @@ -2716,12 +2716,12 @@ of `self`.
Basic usage:
```
", $Feature, "#![feature(leading_trailing_ones)]
let n = 0b1010111", stringify!($SelfT), ";
", $Feature, "let n = 0b1010111", stringify!($SelfT), ";
assert_eq!(n.trailing_ones(), 3);", $EndFeature, "
```"),
#[unstable(feature = "leading_trailing_ones", issue = "57969")]
#[stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]
#[inline]
pub const fn trailing_ones(self) -> u32 {
(!self).trailing_zeros()
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#![feature(const_raw_ptr_deref)]
#![feature(never_type)]
#![feature(unwrap_infallible)]
#![feature(leading_trailing_ones)]
#![feature(const_forget)]
#![feature(option_unwrap_none)]
#![feature(peekable_next_if)]
Expand Down

0 comments on commit c86039b

Please sign in to comment.