Merge from rustc
This commit is contained in:
commit
65e76849ac
183 changed files with 2692 additions and 874 deletions
|
|
@ -139,7 +139,7 @@ pub struct Iter<'a, T: 'a> {
|
|||
#[stable(feature = "collection_debug", since = "1.17.0")]
|
||||
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_tuple("Iter").field(&self.iter.clone()).finish()
|
||||
f.debug_tuple("Iter").field(&self.iter).finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#![deny(warnings)]
|
||||
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||
#![allow(static_mut_refs)]
|
||||
#![cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::fmt::{self, Write};
|
||||
|
|
|
|||
|
|
@ -549,8 +549,6 @@ impl<T: Copy> Cell<T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(cell_update)]
|
||||
///
|
||||
/// use std::cell::Cell;
|
||||
///
|
||||
/// let c = Cell::new(5);
|
||||
|
|
@ -558,7 +556,7 @@ impl<T: Copy> Cell<T> {
|
|||
/// assert_eq!(c.get(), 6);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "cell_update", issue = "50186")]
|
||||
#[stable(feature = "cell_update", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub fn update(&self, f: impl FnOnce(T) -> T) {
|
||||
let old = self.get();
|
||||
self.set(f(old));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ pub(super) const fn from_u32(i: u32) -> Option<char> {
|
|||
/// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`].
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
|
||||
// SAFETY: the caller must guarantee that `i` is a valid char value.
|
||||
unsafe {
|
||||
|
|
@ -221,6 +222,7 @@ impl FromStr for char {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> {
|
||||
// This is an optimized version of the check
|
||||
// (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF),
|
||||
|
|
|
|||
|
|
@ -1497,6 +1497,7 @@ pub const fn forget<T: ?Sized>(_: T);
|
|||
/// Turning raw bytes (`[u8; SZ]`) into `u32`, `f64`, etc.:
|
||||
///
|
||||
/// ```
|
||||
/// # #![cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
/// let raw_bytes = [0x78, 0x56, 0x34, 0x12];
|
||||
///
|
||||
/// let num = unsafe {
|
||||
|
|
@ -2429,35 +2430,35 @@ pub unsafe fn float_to_int_unchecked<Float: Copy, Int: Copy>(value: Float) -> In
|
|||
/// Stabilized as [`f16::algebraic_add`], [`f32::algebraic_add`], [`f64::algebraic_add`] and [`f128::algebraic_add`].
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
pub const fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float subtraction that allows optimizations based on algebraic rules.
|
||||
///
|
||||
/// Stabilized as [`f16::algebraic_sub`], [`f32::algebraic_sub`], [`f64::algebraic_sub`] and [`f128::algebraic_sub`].
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
pub const fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float multiplication that allows optimizations based on algebraic rules.
|
||||
///
|
||||
/// Stabilized as [`f16::algebraic_mul`], [`f32::algebraic_mul`], [`f64::algebraic_mul`] and [`f128::algebraic_mul`].
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
pub const fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float division that allows optimizations based on algebraic rules.
|
||||
///
|
||||
/// Stabilized as [`f16::algebraic_div`], [`f32::algebraic_div`], [`f64::algebraic_div`] and [`f128::algebraic_div`].
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
pub const fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float remainder that allows optimizations based on algebraic rules.
|
||||
///
|
||||
/// Stabilized as [`f16::algebraic_rem`], [`f32::algebraic_rem`], [`f64::algebraic_rem`] and [`f128::algebraic_rem`].
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
pub const fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Returns the number of bits set in an integer type `T`
|
||||
///
|
||||
|
|
|
|||
|
|
@ -197,16 +197,22 @@ impl f128 {
|
|||
#[unstable(feature = "f128", issue = "116909")]
|
||||
pub const MAX: f128 = 1.18973149535723176508575932662800702e+4932_f128;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
/// One greater than the minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MIN_EXP`, then normal numbers
|
||||
/// ≥ 0.5 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all normal numbers representable by this type are
|
||||
/// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>.
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
pub const MIN_EXP: i32 = -16_381;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
/// One greater than the maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MAX_EXP`, then normal numbers
|
||||
/// < 1 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all numbers representable by this type are
|
||||
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
pub const MAX_EXP: i32 = 16_384;
|
||||
|
||||
|
|
@ -804,7 +810,7 @@ impl f128 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// This returns NaN when *either* argument is NaN or if a combination of
|
||||
/// +inf and -inf is provided as arguments.
|
||||
|
|
@ -821,6 +827,7 @@ impl f128 {
|
|||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[doc(alias = "average")]
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
#[rustc_const_unstable(feature = "f128", issue = "116909")]
|
||||
pub const fn midpoint(self, other: f128) -> f128 {
|
||||
|
|
@ -903,6 +910,7 @@ impl f128 {
|
|||
#[inline]
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
#[must_use = "this returns the result of the operation, without modifying the original"]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn to_bits(self) -> u128 {
|
||||
// SAFETY: `u128` is a plain old datatype so we can always transmute to it.
|
||||
unsafe { mem::transmute(self) }
|
||||
|
|
@ -950,6 +958,7 @@ impl f128 {
|
|||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn from_bits(v: u128) -> Self {
|
||||
// It turns out the safety issues with sNaN were overblown! Hooray!
|
||||
// SAFETY: `u128` is a plain old datatype so we can always transmute from it.
|
||||
|
|
@ -1373,8 +1382,9 @@ impl f128 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_add(self, rhs: f128) -> f128 {
|
||||
pub const fn algebraic_add(self, rhs: f128) -> f128 {
|
||||
intrinsics::fadd_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1383,8 +1393,9 @@ impl f128 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_sub(self, rhs: f128) -> f128 {
|
||||
pub const fn algebraic_sub(self, rhs: f128) -> f128 {
|
||||
intrinsics::fsub_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1393,8 +1404,9 @@ impl f128 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_mul(self, rhs: f128) -> f128 {
|
||||
pub const fn algebraic_mul(self, rhs: f128) -> f128 {
|
||||
intrinsics::fmul_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1403,8 +1415,9 @@ impl f128 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_div(self, rhs: f128) -> f128 {
|
||||
pub const fn algebraic_div(self, rhs: f128) -> f128 {
|
||||
intrinsics::fdiv_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1413,8 +1426,9 @@ impl f128 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_rem(self, rhs: f128) -> f128 {
|
||||
pub const fn algebraic_rem(self, rhs: f128) -> f128 {
|
||||
intrinsics::frem_algebraic(self, rhs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,16 +192,22 @@ impl f16 {
|
|||
#[unstable(feature = "f16", issue = "116909")]
|
||||
pub const MAX: f16 = 6.5504e+4_f16;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
/// One greater than the minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MIN_EXP`, then normal numbers
|
||||
/// ≥ 0.5 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all normal numbers representable by this type are
|
||||
/// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>.
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
pub const MIN_EXP: i32 = -13;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
/// One greater than the maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MAX_EXP`, then normal numbers
|
||||
/// < 1 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all numbers representable by this type are
|
||||
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
pub const MAX_EXP: i32 = 16;
|
||||
|
||||
|
|
@ -792,7 +798,7 @@ impl f16 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// This returns NaN when *either* argument is NaN or if a combination of
|
||||
/// +inf and -inf is provided as arguments.
|
||||
|
|
@ -808,6 +814,7 @@ impl f16 {
|
|||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[doc(alias = "average")]
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
#[rustc_const_unstable(feature = "f16", issue = "116909")]
|
||||
pub const fn midpoint(self, other: f16) -> f16 {
|
||||
|
|
@ -891,6 +898,7 @@ impl f16 {
|
|||
#[inline]
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
#[must_use = "this returns the result of the operation, without modifying the original"]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn to_bits(self) -> u16 {
|
||||
// SAFETY: `u16` is a plain old datatype so we can always transmute to it.
|
||||
unsafe { mem::transmute(self) }
|
||||
|
|
@ -937,6 +945,7 @@ impl f16 {
|
|||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn from_bits(v: u16) -> Self {
|
||||
// It turns out the safety issues with sNaN were overblown! Hooray!
|
||||
// SAFETY: `u16` is a plain old datatype so we can always transmute from it.
|
||||
|
|
@ -1349,8 +1358,9 @@ impl f16 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_add(self, rhs: f16) -> f16 {
|
||||
pub const fn algebraic_add(self, rhs: f16) -> f16 {
|
||||
intrinsics::fadd_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1359,8 +1369,9 @@ impl f16 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_sub(self, rhs: f16) -> f16 {
|
||||
pub const fn algebraic_sub(self, rhs: f16) -> f16 {
|
||||
intrinsics::fsub_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1369,8 +1380,9 @@ impl f16 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_mul(self, rhs: f16) -> f16 {
|
||||
pub const fn algebraic_mul(self, rhs: f16) -> f16 {
|
||||
intrinsics::fmul_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1379,8 +1391,9 @@ impl f16 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_div(self, rhs: f16) -> f16 {
|
||||
pub const fn algebraic_div(self, rhs: f16) -> f16 {
|
||||
intrinsics::fdiv_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1389,8 +1402,9 @@ impl f16 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_rem(self, rhs: f16) -> f16 {
|
||||
pub const fn algebraic_rem(self, rhs: f16) -> f16 {
|
||||
intrinsics::frem_algebraic(self, rhs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,16 +443,22 @@ impl f32 {
|
|||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MAX: f32 = 3.40282347e+38_f32;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
/// One greater than the minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MIN_EXP`, then normal numbers
|
||||
/// ≥ 0.5 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all normal numbers representable by this type are
|
||||
/// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>.
|
||||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MIN_EXP: i32 = -125;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
/// One greater than the maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MAX_EXP`, then normal numbers
|
||||
/// < 1 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all numbers representable by this type are
|
||||
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
|
||||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MAX_EXP: i32 = 128;
|
||||
|
||||
|
|
@ -710,8 +716,7 @@ impl f32 {
|
|||
pub const fn is_sign_negative(self) -> bool {
|
||||
// IEEE754 says: isSignMinus(x) is true if and only if x has negative sign. isSignMinus
|
||||
// applies to zeros and NaNs as well.
|
||||
// SAFETY: This is just transmuting to get the sign bit, it's fine.
|
||||
unsafe { mem::transmute::<f32, u32>(self) & 0x8000_0000 != 0 }
|
||||
self.to_bits() & 0x8000_0000 != 0
|
||||
}
|
||||
|
||||
/// Returns the least number greater than `self`.
|
||||
|
|
@ -986,7 +991,7 @@ impl f32 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// This returns NaN when *either* argument is NaN or if a combination of
|
||||
/// +inf and -inf is provided as arguments.
|
||||
|
|
@ -998,6 +1003,7 @@ impl f32 {
|
|||
/// assert_eq!((-5.5f32).midpoint(8.0), 1.25);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[doc(alias = "average")]
|
||||
#[stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
pub const fn midpoint(self, other: f32) -> f32 {
|
||||
|
|
@ -1096,6 +1102,7 @@ impl f32 {
|
|||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn to_bits(self) -> u32 {
|
||||
// SAFETY: `u32` is a plain old datatype so we can always transmute to it.
|
||||
unsafe { mem::transmute(self) }
|
||||
|
|
@ -1141,6 +1148,7 @@ impl f32 {
|
|||
#[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn from_bits(v: u32) -> Self {
|
||||
// It turns out the safety issues with sNaN were overblown! Hooray!
|
||||
// SAFETY: `u32` is a plain old datatype so we can always transmute from it.
|
||||
|
|
@ -1515,8 +1523,9 @@ impl f32 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_add(self, rhs: f32) -> f32 {
|
||||
pub const fn algebraic_add(self, rhs: f32) -> f32 {
|
||||
intrinsics::fadd_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1525,8 +1534,9 @@ impl f32 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_sub(self, rhs: f32) -> f32 {
|
||||
pub const fn algebraic_sub(self, rhs: f32) -> f32 {
|
||||
intrinsics::fsub_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1535,8 +1545,9 @@ impl f32 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_mul(self, rhs: f32) -> f32 {
|
||||
pub const fn algebraic_mul(self, rhs: f32) -> f32 {
|
||||
intrinsics::fmul_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1545,8 +1556,9 @@ impl f32 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_div(self, rhs: f32) -> f32 {
|
||||
pub const fn algebraic_div(self, rhs: f32) -> f32 {
|
||||
intrinsics::fdiv_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1555,8 +1567,9 @@ impl f32 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_rem(self, rhs: f32) -> f32 {
|
||||
pub const fn algebraic_rem(self, rhs: f32) -> f32 {
|
||||
intrinsics::frem_algebraic(self, rhs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,16 +442,22 @@ impl f64 {
|
|||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MAX: f64 = 1.7976931348623157e+308_f64;
|
||||
|
||||
/// One greater than the minimum possible normal power of 2 exponent.
|
||||
/// One greater than the minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MIN_EXP`, then normal numbers
|
||||
/// ≥ 0.5 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all normal numbers representable by this type are
|
||||
/// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>.
|
||||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MIN_EXP: i32 = -1021;
|
||||
/// Maximum possible power of 2 exponent.
|
||||
/// One greater than the maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
|
||||
///
|
||||
/// If <i>x</i> = `MAX_EXP`, then normal numbers
|
||||
/// < 1 × 2<sup><i>x</i></sup>.
|
||||
/// This corresponds to the exact maximum possible power of 2 exponent
|
||||
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
|
||||
/// In other words, all numbers representable by this type are
|
||||
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
|
||||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MAX_EXP: i32 = 1024;
|
||||
|
||||
|
|
@ -718,8 +724,7 @@ impl f64 {
|
|||
pub const fn is_sign_negative(self) -> bool {
|
||||
// IEEE754 says: isSignMinus(x) is true if and only if x has negative sign. isSignMinus
|
||||
// applies to zeros and NaNs as well.
|
||||
// SAFETY: This is just transmuting to get the sign bit, it's fine.
|
||||
unsafe { mem::transmute::<f64, u64>(self) & Self::SIGN_MASK != 0 }
|
||||
self.to_bits() & Self::SIGN_MASK != 0
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
@ -1004,7 +1009,7 @@ impl f64 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// This returns NaN when *either* argument is NaN or if a combination of
|
||||
/// +inf and -inf is provided as arguments.
|
||||
|
|
@ -1016,6 +1021,7 @@ impl f64 {
|
|||
/// assert_eq!((-5.5f64).midpoint(8.0), 1.25);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[doc(alias = "average")]
|
||||
#[stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
pub const fn midpoint(self, other: f64) -> f64 {
|
||||
|
|
@ -1094,6 +1100,7 @@ impl f64 {
|
|||
without modifying the original"]
|
||||
#[stable(feature = "float_bits_conv", since = "1.20.0")]
|
||||
#[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
#[inline]
|
||||
pub const fn to_bits(self) -> u64 {
|
||||
// SAFETY: `u64` is a plain old datatype so we can always transmute to it.
|
||||
|
|
@ -1140,6 +1147,7 @@ impl f64 {
|
|||
#[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
pub const fn from_bits(v: u64) -> Self {
|
||||
// It turns out the safety issues with sNaN were overblown! Hooray!
|
||||
// SAFETY: `u64` is a plain old datatype so we can always transmute from it.
|
||||
|
|
@ -1514,8 +1522,9 @@ impl f64 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_add(self, rhs: f64) -> f64 {
|
||||
pub const fn algebraic_add(self, rhs: f64) -> f64 {
|
||||
intrinsics::fadd_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1524,8 +1533,9 @@ impl f64 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_sub(self, rhs: f64) -> f64 {
|
||||
pub const fn algebraic_sub(self, rhs: f64) -> f64 {
|
||||
intrinsics::fsub_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1534,8 +1544,9 @@ impl f64 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_mul(self, rhs: f64) -> f64 {
|
||||
pub const fn algebraic_mul(self, rhs: f64) -> f64 {
|
||||
intrinsics::fmul_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1544,8 +1555,9 @@ impl f64 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_div(self, rhs: f64) -> f64 {
|
||||
pub const fn algebraic_div(self, rhs: f64) -> f64 {
|
||||
intrinsics::fdiv_algebraic(self, rhs)
|
||||
}
|
||||
|
||||
|
|
@ -1554,8 +1566,9 @@ impl f64 {
|
|||
/// See [algebraic operators](primitive@f32#algebraic-operators) for more info.
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
#[unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[rustc_const_unstable(feature = "float_algebraic", issue = "136469")]
|
||||
#[inline]
|
||||
pub fn algebraic_rem(self, rhs: f64) -> f64 {
|
||||
pub const fn algebraic_rem(self, rhs: f64) -> f64 {
|
||||
intrinsics::frem_algebraic(self, rhs)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3675,6 +3675,7 @@ macro_rules! int_impl {
|
|||
/// ```
|
||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
// SAFETY: const sound because integers are plain old datatypes so we can always
|
||||
// transmute them to arrays of bytes
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
|
|
@ -3778,6 +3779,7 @@ macro_rules! int_impl {
|
|||
/// ```
|
||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
#[must_use]
|
||||
// SAFETY: const sound because integers are plain old datatypes so we can always
|
||||
// transmute to them
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ depending on the target pointer size.
|
|||
|
||||
macro_rules! midpoint_impl {
|
||||
($SelfT:ty, unsigned) => {
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
|
||||
/// sufficiently-large unsigned integral type. This implies that the result is
|
||||
|
|
@ -146,6 +146,8 @@ macro_rules! midpoint_impl {
|
|||
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[doc(alias = "average_floor")]
|
||||
#[doc(alias = "average")]
|
||||
#[inline]
|
||||
pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
|
||||
// Use the well known branchless algorithm from Hacker's Delight to compute
|
||||
|
|
@ -154,7 +156,7 @@ macro_rules! midpoint_impl {
|
|||
}
|
||||
};
|
||||
($SelfT:ty, signed) => {
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
|
||||
/// sufficiently-large signed integral type. This implies that the result is
|
||||
|
|
@ -173,6 +175,9 @@ macro_rules! midpoint_impl {
|
|||
#[rustc_const_stable(feature = "num_midpoint_signed", since = "1.87.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[doc(alias = "average_floor")]
|
||||
#[doc(alias = "average_ceil")]
|
||||
#[doc(alias = "average")]
|
||||
#[inline]
|
||||
pub const fn midpoint(self, rhs: Self) -> Self {
|
||||
// Use the well known branchless algorithm from Hacker's Delight to compute
|
||||
|
|
@ -184,7 +189,7 @@ macro_rules! midpoint_impl {
|
|||
}
|
||||
};
|
||||
($SelfT:ty, $WideT:ty, unsigned) => {
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
|
||||
/// sufficiently-large unsigned integral type. This implies that the result is
|
||||
|
|
@ -200,13 +205,15 @@ macro_rules! midpoint_impl {
|
|||
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[doc(alias = "average_floor")]
|
||||
#[doc(alias = "average")]
|
||||
#[inline]
|
||||
pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
|
||||
((self as $WideT + rhs as $WideT) / 2) as $SelfT
|
||||
}
|
||||
};
|
||||
($SelfT:ty, $WideT:ty, signed) => {
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
|
||||
/// sufficiently-large signed integral type. This implies that the result is
|
||||
|
|
@ -225,6 +232,9 @@ macro_rules! midpoint_impl {
|
|||
#[rustc_const_stable(feature = "num_midpoint_signed", since = "1.87.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[doc(alias = "average_floor")]
|
||||
#[doc(alias = "average_ceil")]
|
||||
#[doc(alias = "average")]
|
||||
#[inline]
|
||||
pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
|
||||
((self as $WideT + rhs as $WideT) / 2) as $SelfT
|
||||
|
|
|
|||
|
|
@ -1589,7 +1589,7 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
|
|||
super::int_log10::$Int(self.get())
|
||||
}
|
||||
|
||||
/// Calculates the middle point of `self` and `rhs`.
|
||||
/// Calculates the midpoint (average) between `self` and `rhs`.
|
||||
///
|
||||
/// `midpoint(a, b)` is `(a + b) >> 1` as if it were performed in a
|
||||
/// sufficiently-large signed integral type. This implies that the result is
|
||||
|
|
@ -1615,6 +1615,8 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
|
|||
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[doc(alias = "average_floor")]
|
||||
#[doc(alias = "average")]
|
||||
#[inline]
|
||||
pub const fn midpoint(self, rhs: Self) -> Self {
|
||||
// SAFETY: The only way to get `0` with midpoint is to have two opposite or
|
||||
|
|
|
|||
|
|
@ -3523,6 +3523,7 @@ macro_rules! uint_impl {
|
|||
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
// SAFETY: const sound because integers are plain old datatypes so we can always
|
||||
// transmute them to arrays of bytes
|
||||
#[inline]
|
||||
|
|
@ -3624,6 +3625,7 @@ macro_rules! uint_impl {
|
|||
/// ```
|
||||
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
|
||||
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
|
||||
#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))]
|
||||
#[must_use]
|
||||
// SAFETY: const sound because integers are plain old datatypes so we can always
|
||||
// transmute to them
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#![feature(async_iterator)]
|
||||
#![feature(bigint_helper_methods)]
|
||||
#![feature(bstr)]
|
||||
#![feature(cell_update)]
|
||||
#![feature(char_max_len)]
|
||||
#![feature(clone_to_uninit)]
|
||||
#![feature(const_eval_select)]
|
||||
|
|
|
|||
|
|
@ -973,6 +973,9 @@ where
|
|||
/// Returns an array of length `N` with the results of each query. For soundness, at most one
|
||||
/// mutable reference will be returned to any value. `None` will be used if the key is missing.
|
||||
///
|
||||
/// This method performs a check to ensure there are no duplicate keys, which currently has a time-complexity of O(n^2),
|
||||
/// so be careful when passing many keys.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if any keys are overlapping.
|
||||
|
|
|
|||
|
|
@ -1100,3 +1100,39 @@ pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io:
|
|||
pub fn chroot<P: AsRef<Path>>(dir: P) -> io::Result<()> {
|
||||
sys::fs::chroot(dir.as_ref())
|
||||
}
|
||||
|
||||
/// Create a FIFO special file at the specified path with the specified mode.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # #![feature(unix_mkfifo)]
|
||||
/// # #[cfg(not(unix))]
|
||||
/// # fn main() {}
|
||||
/// # #[cfg(unix)]
|
||||
/// # fn main() -> std::io::Result<()> {
|
||||
/// # use std::{
|
||||
/// # os::unix::fs::{mkfifo, PermissionsExt},
|
||||
/// # fs::{File, Permissions, remove_file},
|
||||
/// # io::{Write, Read},
|
||||
/// # };
|
||||
/// # let _ = remove_file("/tmp/fifo");
|
||||
/// mkfifo("/tmp/fifo", Permissions::from_mode(0o774))?;
|
||||
///
|
||||
/// let mut wx = File::options().read(true).write(true).open("/tmp/fifo")?;
|
||||
/// let mut rx = File::open("/tmp/fifo")?;
|
||||
///
|
||||
/// wx.write_all(b"hello, world!")?;
|
||||
/// drop(wx);
|
||||
///
|
||||
/// let mut s = String::new();
|
||||
/// rx.read_to_string(&mut s)?;
|
||||
///
|
||||
/// assert_eq!(s, "hello, world!");
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[unstable(feature = "unix_mkfifo", issue = "139324")]
|
||||
pub fn mkfifo<P: AsRef<Path>>(path: P, permissions: Permissions) -> io::Result<()> {
|
||||
sys::fs::mkfifo(path.as_ref(), permissions.mode())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,3 +55,23 @@ fn write_vectored_at() {
|
|||
let content = fs::read(&filename).unwrap();
|
||||
assert_eq!(&content, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mkfifo() {
|
||||
let tmp_dir = crate::test_helpers::tmpdir();
|
||||
|
||||
let fifo = tmp_dir.path().join("fifo");
|
||||
|
||||
mkfifo(&fifo, Permissions::from_mode(0o774)).unwrap();
|
||||
|
||||
let mut wx = fs::File::options().read(true).write(true).open(&fifo).unwrap();
|
||||
let mut rx = fs::File::open(fifo).unwrap();
|
||||
|
||||
wx.write_all(b"hello, world!").unwrap();
|
||||
drop(wx);
|
||||
|
||||
let mut s = String::new();
|
||||
rx.read_to_string(&mut s).unwrap();
|
||||
|
||||
assert_eq!(s, "hello, world!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -389,6 +389,17 @@ pub mod os {
|
|||
pub const EXE_EXTENSION: &str = "exe";
|
||||
}
|
||||
|
||||
#[cfg(target_os = "zkvm")]
|
||||
pub mod os {
|
||||
pub const FAMILY: &str = "";
|
||||
pub const OS: &str = "";
|
||||
pub const DLL_PREFIX: &str = "";
|
||||
pub const DLL_SUFFIX: &str = ".elf";
|
||||
pub const DLL_EXTENSION: &str = "elf";
|
||||
pub const EXE_SUFFIX: &str = ".elf";
|
||||
pub const EXE_EXTENSION: &str = "elf";
|
||||
}
|
||||
|
||||
// The fallback when none of the other gates match.
|
||||
#[else]
|
||||
pub mod os {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ cfg_if::cfg_if! {
|
|||
if #[cfg(target_family = "unix")] {
|
||||
mod unix;
|
||||
use unix as imp;
|
||||
pub use unix::{chown, fchown, lchown};
|
||||
pub use unix::{chown, fchown, lchown, mkfifo};
|
||||
#[cfg(not(target_os = "fuchsia"))]
|
||||
pub use unix::chroot;
|
||||
pub(crate) use unix::debug_assert_fd_is_open;
|
||||
|
|
|
|||
|
|
@ -2137,6 +2137,12 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
|
|||
Err(io::const_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks"))
|
||||
}
|
||||
|
||||
pub fn mkfifo(path: &Path, mode: u32) -> io::Result<()> {
|
||||
run_path_with_cstr(path, &|path| {
|
||||
cvt(unsafe { libc::mkfifo(path.as_ptr(), mode.try_into().unwrap()) }).map(|_| ())
|
||||
})
|
||||
}
|
||||
|
||||
pub use remove_dir_impl::remove_dir_all;
|
||||
|
||||
// Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
pub mod os {
|
||||
pub const FAMILY: &str = "";
|
||||
pub const OS: &str = "";
|
||||
pub const DLL_PREFIX: &str = "";
|
||||
pub const DLL_SUFFIX: &str = ".elf";
|
||||
pub const DLL_EXTENSION: &str = "elf";
|
||||
pub const EXE_SUFFIX: &str = ".elf";
|
||||
pub const EXE_EXTENSION: &str = "elf";
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 4666c7376f25a265c74535585d622da3da6dfeb1
|
||||
Subproject commit 1245618ccf5b2df7ab1ebb0279b9f3f726670161
|
||||
Loading…
Add table
Add a link
Reference in a new issue