Auto merge of #39296 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests - Successful merges: #38930, #39212, #39251, #39267, #39276, #39278 - Failed merges:
This commit is contained in:
commit
fc57e40ce7
@ -384,7 +384,7 @@ currently trying to run the tests. This can save compile time, and also ensures
|
||||
that our tests are entirely left out of a normal build.
|
||||
|
||||
The second change is the `use` declaration. Because we're in an inner module,
|
||||
we need to bring our test function into scope. This can be annoying if you have
|
||||
we need to bring the tested function into scope. This can be annoying if you have
|
||||
a large module, and so this is a common use of globs. Let's change our
|
||||
`src/lib.rs` to make use of it:
|
||||
|
||||
|
@ -2776,7 +2776,7 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {}
|
||||
#[unstable(feature = "coerce_unsized", issue = "27732")]
|
||||
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
|
||||
|
||||
/// Both `in (PLACE) EXPR` and `box EXPR` desugar into expressions
|
||||
/// Both `PLACE <- EXPR` and `box EXPR` desugar into expressions
|
||||
/// that allocate an intermediate "place" that holds uninitialized
|
||||
/// state. The desugaring evaluates EXPR, and writes the result at
|
||||
/// the address returned by the `pointer` method of this trait.
|
||||
@ -2791,7 +2791,7 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
|
||||
/// converting the agent to an instance of the owning pointer, via the
|
||||
/// appropriate `finalize` method (see the `InPlace`.
|
||||
///
|
||||
/// If evaluating EXPR fails, then the destructor for the
|
||||
/// If evaluating EXPR fails, then it is up to the destructor for the
|
||||
/// implementation of Place to clean up any intermediate state
|
||||
/// (e.g. deallocate box storage, pop a stack, etc).
|
||||
#[unstable(feature = "placement_new_protocol", issue = "27779")]
|
||||
@ -2802,9 +2802,9 @@ pub trait Place<Data: ?Sized> {
|
||||
fn pointer(&mut self) -> *mut Data;
|
||||
}
|
||||
|
||||
/// Interface to implementations of `in (PLACE) EXPR`.
|
||||
/// Interface to implementations of `PLACE <- EXPR`.
|
||||
///
|
||||
/// `in (PLACE) EXPR` effectively desugars into:
|
||||
/// `PLACE <- EXPR` effectively desugars into:
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// let p = PLACE;
|
||||
@ -2817,7 +2817,7 @@ pub trait Place<Data: ?Sized> {
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// The type of `in (PLACE) EXPR` is derived from the type of `PLACE`;
|
||||
/// The type of `PLACE <- EXPR` is derived from the type of `PLACE`;
|
||||
/// if the type of `PLACE` is `P`, then the final type of the whole
|
||||
/// expression is `P::Place::Owner` (see the `InPlace` and `Boxed`
|
||||
/// traits).
|
||||
@ -2835,12 +2835,12 @@ pub trait Placer<Data: ?Sized> {
|
||||
fn make_place(self) -> Self::Place;
|
||||
}
|
||||
|
||||
/// Specialization of `Place` trait supporting `in (PLACE) EXPR`.
|
||||
/// Specialization of `Place` trait supporting `PLACE <- EXPR`.
|
||||
#[unstable(feature = "placement_new_protocol", issue = "27779")]
|
||||
pub trait InPlace<Data: ?Sized>: Place<Data> {
|
||||
/// `Owner` is the type of the end value of `in (PLACE) EXPR`
|
||||
/// `Owner` is the type of the end value of `PLACE <- EXPR`
|
||||
///
|
||||
/// Note that when `in (PLACE) EXPR` is solely used for
|
||||
/// Note that when `PLACE <- EXPR` is solely used for
|
||||
/// side-effecting an existing data-structure,
|
||||
/// e.g. `Vec::emplace_back`, then `Owner` need not carry any
|
||||
/// information at all (e.g. it can be the unit type `()` in that
|
||||
|
@ -62,9 +62,8 @@ fn test_writer_hasher() {
|
||||
|
||||
let s: &str = "a";
|
||||
assert_eq!(hash(& s), 97 + 0xFF);
|
||||
// FIXME (#18283) Enable test
|
||||
//let s: Box<str> = box "a";
|
||||
//assert_eq!(hasher.hash(& s), 97 + 0xFF);
|
||||
let s: Box<str> = String::from("a").into_boxed_str();
|
||||
assert_eq!(hash(& s), 97 + 0xFF);
|
||||
let cs: &[u8] = &[1, 2, 3];
|
||||
assert_eq!(hash(& cs), 9);
|
||||
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
|
||||
|
@ -154,7 +154,7 @@ pub trait Visitor<'v> : Sized {
|
||||
/// hashed separately.
|
||||
///
|
||||
/// **If for some reason you want the nested behavior, but don't
|
||||
/// have a `Map` are your disposal:** then you should override the
|
||||
/// have a `Map` at your disposal:** then you should override the
|
||||
/// `visit_nested_XXX` methods, and override this method to
|
||||
/// `panic!()`. This way, if a new `visit_nested_XXX` variant is
|
||||
/// added in the future, we will see the panic in your code and
|
||||
|
@ -1014,7 +1014,7 @@ pub enum QPath {
|
||||
///
|
||||
/// UFCS source paths can desugar into this, with `Vec::new` turning into
|
||||
/// `<Vec>::new`, and `T::X::Y::method` into `<<<T>::X>::Y>::method`,
|
||||
/// the `X` and `Y` nodes being each a `TyPath(QPath::TypeRelative(..))`.
|
||||
/// the `X` and `Y` nodes each being a `TyPath(QPath::TypeRelative(..))`.
|
||||
TypeRelative(P<Ty>, P<PathSegment>)
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ mod prim_pointer { }
|
||||
/// Arrays of sizes from 0 to 32 (inclusive) implement the following traits if
|
||||
/// the element type allows it:
|
||||
///
|
||||
/// - [`Clone`][clone] (only if `T: Copy`)
|
||||
/// - [`Clone`][clone] (only if `T: [Copy][copy]`)
|
||||
/// - [`Debug`][debug]
|
||||
/// - [`IntoIterator`][intoiterator] (implemented for `&[T; N]` and `&mut [T; N]`)
|
||||
/// - [`PartialEq`][partialeq], [`PartialOrd`][partialord], [`Eq`][eq], [`Ord`][ord]
|
||||
@ -287,8 +287,8 @@ mod prim_pointer { }
|
||||
/// entirely different types. As a stopgap, trait implementations are
|
||||
/// statically generated up to size 32.
|
||||
///
|
||||
/// Arrays of *any* size are [`Copy`][copy] if the element type is `Copy`. This
|
||||
/// works because the `Copy` trait is specially known to the compiler.
|
||||
/// Arrays of *any* size are [`Copy`][copy] if the element type is [`Copy`][copy]. This
|
||||
/// works because the [`Copy`][copy] trait is specially known to the compiler.
|
||||
///
|
||||
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
||||
/// an array. Indeed, this provides most of the API for working with arrays.
|
||||
@ -297,23 +297,6 @@ mod prim_pointer { }
|
||||
/// There is no way to move elements out of an array. See [`mem::replace`][replace]
|
||||
/// for an alternative.
|
||||
///
|
||||
/// [slice]: primitive.slice.html
|
||||
/// [copy]: marker/trait.Copy.html
|
||||
/// [clone]: clone/trait.Clone.html
|
||||
/// [debug]: fmt/trait.Debug.html
|
||||
/// [intoiterator]: iter/trait.IntoIterator.html
|
||||
/// [partialeq]: cmp/trait.PartialEq.html
|
||||
/// [partialord]: cmp/trait.PartialOrd.html
|
||||
/// [eq]: cmp/trait.Eq.html
|
||||
/// [ord]: cmp/trait.Ord.html
|
||||
/// [hash]: hash/trait.Hash.html
|
||||
/// [asref]: convert/trait.AsRef.html
|
||||
/// [asmut]: convert/trait.AsMut.html
|
||||
/// [borrow]: borrow/trait.Borrow.html
|
||||
/// [borrowmut]: borrow/trait.BorrowMut.html
|
||||
/// [default]: default/trait.Default.html
|
||||
/// [replace]: mem/fn.replace.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -347,13 +330,31 @@ mod prim_pointer { }
|
||||
/// ```
|
||||
///
|
||||
/// If the array has 32 or fewer elements (see above), you can also use the
|
||||
/// array reference's `IntoIterator` implementation:
|
||||
/// array reference's [`IntoIterator`] implementation:
|
||||
///
|
||||
/// ```
|
||||
/// # let array: [i32; 3] = [0; 3];
|
||||
/// for x in &array { }
|
||||
/// ```
|
||||
///
|
||||
/// [slice]: primitive.slice.html
|
||||
/// [copy]: marker/trait.Copy.html
|
||||
/// [clone]: clone/trait.Clone.html
|
||||
/// [debug]: fmt/trait.Debug.html
|
||||
/// [intoiterator]: iter/trait.IntoIterator.html
|
||||
/// [partialeq]: cmp/trait.PartialEq.html
|
||||
/// [partialord]: cmp/trait.PartialOrd.html
|
||||
/// [eq]: cmp/trait.Eq.html
|
||||
/// [ord]: cmp/trait.Ord.html
|
||||
/// [hash]: hash/trait.Hash.html
|
||||
/// [asref]: convert/trait.AsRef.html
|
||||
/// [asmut]: convert/trait.AsMut.html
|
||||
/// [borrow]: borrow/trait.Borrow.html
|
||||
/// [borrowmut]: borrow/trait.BorrowMut.html
|
||||
/// [default]: default/trait.Default.html
|
||||
/// [replace]: mem/fn.replace.html
|
||||
/// [`IntoIterator`]: iter/trait.IntoIterator.html
|
||||
///
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
mod prim_array { }
|
||||
|
||||
|
@ -33,9 +33,16 @@ use vec;
|
||||
const TMPBUF_SZ: usize = 128;
|
||||
static ENV_LOCK: Mutex = Mutex::new();
|
||||
|
||||
extern {
|
||||
#[link_name = "__errno_location"]
|
||||
fn errno_location() -> *mut i32;
|
||||
}
|
||||
|
||||
/// Returns the platform-specific value of errno
|
||||
pub fn errno() -> i32 {
|
||||
0
|
||||
unsafe {
|
||||
(*errno_location())
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets a detailed string description for the given error number.
|
||||
|
Loading…
x
Reference in New Issue
Block a user