Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion library/alloc/src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use core::cmp::Ordering;
use core::hash::{Hash, Hasher};
use core::ops::Deref;
#[cfg(not(no_global_oom_handling))]
use core::ops::{Add, AddAssign};
use core::ops::{Deref, DerefPure};

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::borrow::{Borrow, BorrowMut};
Expand Down Expand Up @@ -343,6 +343,9 @@ where
}
}

#[unstable(feature = "deref_pure_trait", issue = "87121")]
unsafe impl<B: ?Sized + ToOwned> DerefPure for Cow<'_, B> where B::Owned: Borrow<B> {}

#[stable(feature = "rust1", since = "1.0.0")]
impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {}

Expand Down
8 changes: 7 additions & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ use crate::cmp::Ordering;
use crate::fmt::{self, Debug, Display};
use crate::marker::{PhantomData, Unsize};
use crate::mem::{self, size_of};
use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn};
use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn};
use crate::ptr::{self, NonNull};

mod lazy;
Expand Down Expand Up @@ -1452,6 +1452,9 @@ impl<T: ?Sized> Deref for Ref<'_, T> {
}
}

#[unstable(feature = "deref_pure_trait", issue = "87121")]
unsafe impl<T: ?Sized> DerefPure for Ref<'_, T> {}

impl<'b, T: ?Sized> Ref<'b, T> {
/// Copies a `Ref`.
///
Expand Down Expand Up @@ -1844,6 +1847,9 @@ impl<T: ?Sized> DerefMut for RefMut<'_, T> {
}
}

#[unstable(feature = "deref_pure_trait", issue = "87121")]
unsafe impl<T: ?Sized> DerefPure for RefMut<'_, T> {}

#[unstable(feature = "coerce_unsized", issue = "18598")]
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}

Expand Down
5 changes: 4 additions & 1 deletion library/core/src/mem/manually_drop.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::ops::{Deref, DerefMut};
use crate::ops::{Deref, DerefMut, DerefPure};
use crate::ptr;

/// A wrapper to inhibit compiler from automatically calling `T`’s destructor.
Expand Down Expand Up @@ -161,3 +161,6 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
&mut self.value
}
}

#[unstable(feature = "deref_pure_trait", issue = "87121")]
unsafe impl<T: ?Sized> DerefPure for ManuallyDrop<T> {}
5 changes: 4 additions & 1 deletion library/core/src/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
use crate::cmp;
use crate::fmt;
use crate::hash::{Hash, Hasher};
use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Receiver};
use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver};

#[allow(unused_imports)]
use crate::{
Expand Down Expand Up @@ -1684,6 +1684,9 @@ impl<Ptr: DerefMut<Target: Unpin>> DerefMut for Pin<Ptr> {
}
}

#[unstable(feature = "deref_pure_trait", issue = "87121")]
unsafe impl<Ptr: DerefPure> DerefPure for Pin<Ptr> {}

#[unstable(feature = "receiver_trait", issue = "none")]
impl<Ptr: Receiver> Receiver for Pin<Ptr> {}

Expand Down