Skip to content

Commit

Permalink
Return &T / &mut T in ManuallyDrop Deref(Mut) impl
Browse files Browse the repository at this point in the history
Without this change the generated documentation looks like this:

    fn deref(&self) -> &<ManuallyDrop<T> as Deref>::Target

Returning the actual type directly makes the generated docs more clear:

    fn deref(&self) -> &T
  • Loading branch information
petertodd committed Oct 29, 2018
1 parent d586d5d commit bc18857
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/mem.rs
Expand Up @@ -1018,15 +1018,15 @@ impl<T: ?Sized> ManuallyDrop<T> {
impl<T: ?Sized> Deref for ManuallyDrop<T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
fn deref(&self) -> &T {
&self.value
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
fn deref_mut(&mut self) -> &mut T {
&mut self.value
}
}
Expand Down

0 comments on commit bc18857

Please sign in to comment.