]> git.lizzy.rs Git - rust.git/commit
Auto merge of #55278 - Centril:constification-1, r=alexcrichton
authorbors <bors@rust-lang.org>
Mon, 12 Nov 2018 18:54:11 +0000 (18:54 +0000)
committerbors <bors@rust-lang.org>
Mon, 12 Nov 2018 18:54:11 +0000 (18:54 +0000)
commit65204a97d4876b897df0a70c0b9248b57e2bf057
tree7f2e329a44787eecd22ce6343377305706ac2209
parent0195812aeafeecaa8760a4ddceae187472db8fe6
parentac1c6b0378789250a5070772ad18e936949c7a3c
Auto merge of #55278 - Centril:constification-1, r=alexcrichton

Minor standard library constification

This PR makes some bits of the standard library into `const fn`s.
I've tried to be as aggressive as I possibly could in the constification.
The list is rather small due to how restrictive `const fn` is at the moment.

r? @oli-obk cc @rust-lang/libs

Stable public APIs affected:
+ [x] `Cell::as_ptr`
+ [x] `UnsafeCell::get`
+ [x] `char::is_ascii`
+ [x] `iter::empty`
+ [x] `ManuallyDrop::{new, into_inner}`
+ [x] `RangeInclusive::{start, end}`
+ [x] `NonNull::as_ptr`
+ [x] `{[T], str}::as_ptr`
+ [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}`
+ [x] `CStr::as_ptr`
+ [x] `Ipv4Addr::is_unspecified`
+ [x] `Ipv6Addr::new`
+ [x] `Ipv6Addr::octets`

Unstable public APIs affected:
+ [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}`
+ [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}`
+ [x] `core::convert::identity`

--------------------------

## Removed from list in first pass:

Stable public APIs affected:
+ [ ] `BTree{Map, Set}::{len, is_empty}`
+ [ ] `VecDeque::is_empty`
+ [ ] `String::{is_empty, len}`
+ [ ] `FromUtf8Error::utf8_error`
+ [ ] `Vec<T>::{is_empty, len}`
+ [ ] `Layout::size`
+ [ ] `DecodeUtf16Error::unpaired_surrogate`
+ [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}`
+ [ ] `panic::Location::{file, line, column}`
+ [ ] `{ChunksExact, RChunksExact}::remainder`
+ [ ] `Utf8Error::valid_up_to`
+ [ ] `VacantEntry::key`
+ [ ] `NulError::nul_position`
+ [ ] `IntoStringError::utf8_error`
+ [ ] `IntoInnerError::error`
+ [ ] `io::Chain::get_ref`
+ [ ] `io::Take::{limit, get_ref}`
+ [ ] `SocketAddrV6::{flowinfo, scope_id}`
+ [ ] `PrefixComponent::{kind, as_os_str}`
+ [ ] `Path::{ancestors, display}`
+ [ ] `WaitTimeoutResult::timed_out`
+ [ ] `Receiver::{iter, try_iter}`
+ [ ] `thread::JoinHandle::thread`
+ [ ] `SystemTimeError::duration`

Unstable public APIs affected:
+ [ ] `core::fmt::Arguments::new_v1`
+ [ ] `core::fmt::Arguments::new_v1_formatted`
+ [ ] `Pin::{get_ref, into_ref}`
+ [ ] `Utf8Lossy::chunks`
+ [ ] `LocalWaker::as_waker`
+ [ ] `panic::PanicInfo::{internal_constructor, message, location}`
+ [ ] `panic::Location::{internal_constructor }`

## Removed from list in 2nd pass:

Stable public APIs affected:
+ [ ] `LinkedList::{new, iter, is_empty, len}`
+ [ ] `mem::forget`
+ [ ] `Cursor::{new, get_ref, position}`
+ [ ] `io::{empty, repeat, sink}`
+ [ ] `PoisonError::new`
+ [ ] `thread::Builder::new`
+ [ ] `process::Stdio::{piped, inherit, null}`

Unstable public APIs affected:
+ [ ] `io::Initializer::{zeroing, should_initialize}`
src/libcore/lib.rs
src/libcore/mem.rs
src/libcore/ptr.rs
src/libstd/ffi/c_str.rs