Skip to content

Commit

Permalink
Auto merge of #57234 - Centril:const-stabilizations-2, r=oli-obk
Browse files Browse the repository at this point in the history
Const-stabilize `const_int_ops` + `const_ip`

r? @oli-obk

## Note for relnotes: This PR includes #57105.

I've added T-lang since this affects intrinsics and the operational semantics of Rust's `const fn` fragment.

## Stable APIs proposed for constification

+ `const_int_ops`:
    + `count_ones`
    + `count_zeros`
    + `leading_zeros`
    + `trailing_zeros`
    + `swap_bytes`
    + `from_be`
    + `from_le`
    + `to_be`
    + `to_le`
+ `const_ip`
    + `Ipv4Addr::new`

## Unstable APIs constified

+ `const_int_conversion`:
    + `reverse_bits`
  • Loading branch information
bors committed Jan 12, 2019
2 parents b439861 + 14be8a7 commit 0c91f3d
Show file tree
Hide file tree
Showing 19 changed files with 669 additions and 198 deletions.
8 changes: 4 additions & 4 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ extern "rust-intrinsic" {
/// use std::intrinsics::ctlz;
///
/// let x = 0b0001_1100_u8;
/// let num_leading = unsafe { ctlz(x) };
/// let num_leading = ctlz(x);
/// assert_eq!(num_leading, 3);
/// ```
///
Expand All @@ -1360,7 +1360,7 @@ extern "rust-intrinsic" {
/// use std::intrinsics::ctlz;
///
/// let x = 0u16;
/// let num_leading = unsafe { ctlz(x) };
/// let num_leading = ctlz(x);
/// assert_eq!(num_leading, 16);
/// ```
pub fn ctlz<T>(x: T) -> T;
Expand Down Expand Up @@ -1391,7 +1391,7 @@ extern "rust-intrinsic" {
/// use std::intrinsics::cttz;
///
/// let x = 0b0011_1000_u8;
/// let num_trailing = unsafe { cttz(x) };
/// let num_trailing = cttz(x);
/// assert_eq!(num_trailing, 3);
/// ```
///
Expand All @@ -1403,7 +1403,7 @@ extern "rust-intrinsic" {
/// use std::intrinsics::cttz;
///
/// let x = 0u16;
/// let num_trailing = unsafe { cttz(x) };
/// let num_trailing = cttz(x);
/// assert_eq!(num_trailing, 16);
/// ```
pub fn cttz<T>(x: T) -> T;
Expand Down
6 changes: 2 additions & 4 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(const_int_ops)]
#![cfg_attr(stage0, feature(const_int_ops))]
#![feature(const_fn_union)]
#![feature(custom_attribute)]
#![feature(doc_cfg)]
Expand Down Expand Up @@ -114,9 +114,7 @@
#![feature(const_slice_len)]
#![feature(const_str_as_bytes)]
#![feature(const_str_len)]
#![feature(const_int_rotate)]
#![feature(const_int_wrapping)]
#![feature(const_int_sign)]
#![cfg_attr(stage0, feature(const_int_rotate))]
#![feature(const_int_conversion)]
#![feature(const_transmute)]
#![feature(reverse_bits)]
Expand Down
Loading

0 comments on commit 0c91f3d

Please sign in to comment.