#![feature(const_fn)]
#![feature(const_int_ops)]
#![feature(const_fn_union)]
- #![feature(const_manually_drop_new)]
#![feature(custom_attribute)]
#![feature(doc_cfg)]
#![feature(doc_spotlight)]
mod tuple;
mod unit;
-// Pull in the the `coresimd` crate directly into libcore. This is where all the
+// Pull in the `coresimd` crate directly into libcore. This is where all the
// architecture-specific (and vendor-specific) intrinsics are defined. AKA
// things like SIMD and such. Note that the actual source for all this lies in a
// different repository, rust-lang-nursery/stdsimd. That's why the setup here is
///
/// ## Size of Enums
///
-/// Enums that carry no data other than the descriminant have the same size as C enums
+/// Enums that carry no data other than the discriminant have the same size as C enums
/// on the platform they are compiled for.
///
/// ## Size of Unions
/// ManuallyDrop::new(Box::new(()));
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
- #[rustc_const_unstable(feature = "const_manually_drop_new")]
#[inline]
pub const fn new(value: T) -> ManuallyDrop<T> {
ManuallyDrop { value }
/// ```
#[stable(feature = "manually_drop", since = "1.20.0")]
#[inline]
- pub fn into_inner(slot: ManuallyDrop<T>) -> T {
+ pub const fn into_inner(slot: ManuallyDrop<T>) -> T {
slot.value
}
///
/// # Unsafety
///
- /// It is up to the caller to guarantee that the the `MaybeUninit` really is in an initialized
+ /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
/// state, otherwise this will immediately cause undefined behavior.
#[unstable(feature = "maybe_uninit", issue = "53491")]
pub unsafe fn into_inner(self) -> T {
///
/// # Unsafety
///
- /// It is up to the caller to guarantee that the the `MaybeUninit` really is in an initialized
+ /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
/// state, otherwise this will immediately cause undefined behavior.
#[unstable(feature = "maybe_uninit", issue = "53491")]
pub unsafe fn get_ref(&self) -> &T {
///
/// # Unsafety
///
- /// It is up to the caller to guarantee that the the `MaybeUninit` really is in an initialized
+ /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized
/// state, otherwise this will immediately cause undefined behavior.
#[unstable(feature = "maybe_uninit", issue = "53491")]
pub unsafe fn get_mut(&mut self) -> &mut T {
///
/// Additionally, if `T` is not [`Copy`], using the pointed-to value after
/// calling `drop_in_place` can cause undefined behavior. Note that `*to_drop =
-/// foo` counts as a use because it will cause the the value to be dropped
+/// foo` counts as a use because it will cause the value to be dropped
/// again. [`write`] can be used to overwrite data without causing it to be
/// dropped.
///
#[inline]
unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
// The approach here is to utilize simd to swap x & y efficiently. Testing reveals
- // that swapping either 32 bytes or 64 bytes at a time is most efficient for intel
+ // that swapping either 32 bytes or 64 bytes at a time is most efficient for Intel
// Haswell E processors. LLVM is more able to optimize if we give a struct a
// #[repr(simd)], even if we don't actually use this struct directly.
//
/// # Null-unchecked version
///
/// If you are sure the pointer can never be null and are looking for some kind of
- /// `as_ref_unchecked` that returns the `&T` instead of `Option<&T>, know that you can
+ /// `as_ref_unchecked` that returns the `&T` instead of `Option<&T>`, know that you can
/// dereference the pointer directly.
///
/// ```
/// # Null-unchecked version
///
/// If you are sure the pointer can never be null and are looking for some kind of
- /// `as_ref_unchecked` that returns the `&T` instead of `Option<&T>, know that you can
+ /// `as_ref_unchecked` that returns the `&T` instead of `Option<&T>`, know that you can
/// dereference the pointer directly.
///
/// ```
/// Acquires the underlying `*mut` pointer.
#[stable(feature = "nonnull", since = "1.25.0")]
#[inline]
- pub fn as_ptr(self) -> *mut T {
+ pub const fn as_ptr(self) -> *mut T {
self.pointer.0 as *mut T
}
/// [`CString`]: struct.CString.html
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
- pub fn as_ptr(&self) -> *const c_char {
+ pub const fn as_ptr(&self) -> *const c_char {
self.inner.as_ptr()
}
///
/// If the contents of the `CStr` are valid UTF-8 data, this
/// function will return a [`Cow`]`::`[`Borrowed`]`(`[`&str`]`)`
- /// with the the corresponding [`&str`] slice. Otherwise, it will
+ /// with the corresponding [`&str`] slice. Otherwise, it will
/// replace any invalid UTF-8 sequences with
/// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
/// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.