Skip to content

Rollup of 5 pull requests #62665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7 changes: 5 additions & 2 deletions src/libcore/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ impl fmt::Display for AllocErr {
}
}

/// The `CannotReallocInPlace` error is used when `grow_in_place` or
/// `shrink_in_place` were unable to reuse the given memory block for
/// The `CannotReallocInPlace` error is used when [`grow_in_place`] or
/// [`shrink_in_place`] were unable to reuse the given memory block for
/// a requested layout.
///
/// [`grow_in_place`]: ./trait.Alloc.html#method.grow_in_place
/// [`shrink_in_place`]: ./trait.Alloc.html#method.shrink_in_place
#[unstable(feature = "allocator_api", issue = "32838")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct CannotReallocInPlace;
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl<T:Copy> Clone for Cell<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T:Default> Default for Cell<T> {
impl<T: Default> Default for Cell<T> {
/// Creates a `Cell<T>`, with the `Default` value for T.
#[inline]
fn default() -> Cell<T> {
Expand All @@ -299,18 +299,18 @@ impl<T:Default> Default for Cell<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T:PartialEq + Copy> PartialEq for Cell<T> {
impl<T: PartialEq + Copy> PartialEq for Cell<T> {
#[inline]
fn eq(&self, other: &Cell<T>) -> bool {
self.get() == other.get()
}
}

#[stable(feature = "cell_eq", since = "1.2.0")]
impl<T:Eq + Copy> Eq for Cell<T> {}
impl<T: Eq + Copy> Eq for Cell<T> {}

#[stable(feature = "cell_ord", since = "1.10.0")]
impl<T:PartialOrd + Copy> PartialOrd for Cell<T> {
impl<T: PartialOrd + Copy> PartialOrd for Cell<T> {
#[inline]
fn partial_cmp(&self, other: &Cell<T>) -> Option<Ordering> {
self.get().partial_cmp(&other.get())
Expand Down Expand Up @@ -338,7 +338,7 @@ impl<T:PartialOrd + Copy> PartialOrd for Cell<T> {
}

#[stable(feature = "cell_ord", since = "1.10.0")]
impl<T:Ord + Copy> Ord for Cell<T> {
impl<T: Ord + Copy> Ord for Cell<T> {
#[inline]
fn cmp(&self, other: &Cell<T>) -> Ordering {
self.get().cmp(&other.get())
Expand Down Expand Up @@ -1008,7 +1008,7 @@ impl<T: Clone> Clone for RefCell<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T:Default> Default for RefCell<T> {
impl<T: Default> Default for RefCell<T> {
/// Creates a `RefCell<T>`, with the `Default` value for T.
#[inline]
fn default() -> RefCell<T> {
Expand Down
13 changes: 8 additions & 5 deletions src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ impl fmt::Debug for c_void {
#[lang = "va_list"]
pub struct VaListImpl<'f> {
ptr: *mut c_void,
_marker: PhantomData<&'f c_void>,

// Invariant over `'f`, so each `VaListImpl<'f>` object is tied to
// the region of the function it's defined in
_marker: PhantomData<&'f mut &'f c_void>,
}

#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
Expand Down Expand Up @@ -96,7 +99,7 @@ pub struct VaListImpl<'f> {
vr_top: *mut c_void,
gr_offs: i32,
vr_offs: i32,
_marker: PhantomData<&'f c_void>,
_marker: PhantomData<&'f mut &'f c_void>,
}

/// PowerPC ABI implementation of a `va_list`.
Expand All @@ -114,7 +117,7 @@ pub struct VaListImpl<'f> {
reserved: u16,
overflow_arg_area: *mut c_void,
reg_save_area: *mut c_void,
_marker: PhantomData<&'f c_void>,
_marker: PhantomData<&'f mut &'f c_void>,
}

/// x86_64 ABI implementation of a `va_list`.
Expand All @@ -131,7 +134,7 @@ pub struct VaListImpl<'f> {
fp_offset: i32,
overflow_arg_area: *mut c_void,
reg_save_area: *mut c_void,
_marker: PhantomData<&'f c_void>,
_marker: PhantomData<&'f mut &'f c_void>,
}

/// asm.js ABI implementation of a `va_list`.
Expand All @@ -148,7 +151,7 @@ pub struct VaListImpl<'f> {
#[lang = "va_list"]
pub struct VaListImpl<'f> {
inner: [crate::mem::MaybeUninit<i32>; 4],
_marker: PhantomData<&'f c_void>,
_marker: PhantomData<&'f mut &'f c_void>,
}

#[cfg(all(target_arch = "asmjs", not(windows)))]
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ impl<T> Option<T> {


/// Converts from [`Pin`]`<&Option<T>>` to `Option<`[`Pin`]`<&T>>`.
///
/// [`Pin`]: ../pin/struct.Pin.html
#[inline]
#[stable(feature = "pin", since = "1.33.0")]
pub fn as_pin_ref<'a>(self: Pin<&'a Option<T>>) -> Option<Pin<&'a T>> {
Expand All @@ -300,6 +302,8 @@ impl<T> Option<T> {
}

/// Converts from [`Pin`]`<&mut Option<T>>` to `Option<`[`Pin`]`<&mut T>>`.
///
/// [`Pin`]: ../pin/struct.Pin.html
#[inline]
#[stable(feature = "pin", since = "1.33.0")]
pub fn as_pin_mut<'a>(self: Pin<&'a mut Option<T>>) -> Option<Pin<&'a mut T>> {
Expand Down
7 changes: 4 additions & 3 deletions src/libstd/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::sys_common::{AsInner, IntoInner, FromInner};
/// in each pair are owned strings; the latter are borrowed
/// references.
///
/// Note, `OsString` and `OsStr` internally do not necessarily hold strings in
/// Note, `OsString` and [`OsStr`] internally do not necessarily hold strings in
/// the form native to the platform; While on Unix, strings are stored as a
/// sequence of 8-bit values, on Windows, where strings are 16-bit value based
/// as just discussed, strings are also actually stored as a sequence of 8-bit
Expand Down Expand Up @@ -667,10 +667,11 @@ impl From<&OsStr> for Box<OsStr> {

#[stable(feature = "os_string_from_box", since = "1.18.0")]
impl From<Box<OsStr>> for OsString {
/// Converts a `Box<OsStr>` into a `OsString` without copying or allocating.
/// Converts a [`Box`]`<`[`OsStr`]`>` into a `OsString` without copying or
/// allocating.
///
/// [`Box`]: ../boxed/struct.Box.html
/// [`OsString`]: ../ffi/struct.OsString.html
/// [`OsStr`]: ../ffi/struct.OsStr.html
fn from(boxed: Box<OsStr>) -> OsString {
boxed.into_os_string()
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/c-variadic/variadic-ffi-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) {

pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
*ap0 = ap1; //~ ERROR: mismatched types
//~^ ERROR: mismatched types
}

pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...) {
Expand All @@ -29,5 +30,6 @@ pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaListImpl, mut ap1: ...
}

pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) {
*ap0 = ap1.clone(); //~ ERROR: cannot infer an appropriate lifetime
*ap0 = ap1.clone(); //~ ERROR: mismatched types
//~^ ERROR: mismatched types
}
Loading