Skip to content

Commit

Permalink
Rollup merge of rust-lang#73032 - yoshuawuyts:stabilize-leading_trail…
Browse files Browse the repository at this point in the history
…ing_ones, r=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 rust-lang#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
Dylan-DPC authored Jun 28, 2020
2 parents 2f517ce + 8bc6b5b commit 654c56d
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 654c56d

Please sign in to comment.