Skip to content

Commit 1c57f0a

Browse files
Rollup merge of rust-lang#55485 - petertodd:2018-10-manuallydrop-deref, r=TimNN
Return &T / &mut T in ManuallyDrop Deref(Mut) impl 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 Basically, compare how the impl for `Box<T>` and `ManuallyDrop<T>` looks in this screenshot: ![rust docs for ManuallyDrop as Deref](https://user-images.githubusercontent.com/7042/47673083-fc9dc280-db89-11e8-89b0-c6bde663feef.png)
2 parents 9aedfd5 + bc18857 commit 1c57f0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/mem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,15 +1016,15 @@ impl<T: ?Sized> ManuallyDrop<T> {
10161016
impl<T: ?Sized> Deref for ManuallyDrop<T> {
10171017
type Target = T;
10181018
#[inline]
1019-
fn deref(&self) -> &Self::Target {
1019+
fn deref(&self) -> &T {
10201020
&self.value
10211021
}
10221022
}
10231023

10241024
#[stable(feature = "manually_drop", since = "1.20.0")]
10251025
impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
10261026
#[inline]
1027-
fn deref_mut(&mut self) -> &mut Self::Target {
1027+
fn deref_mut(&mut self) -> &mut T {
10281028
&mut self.value
10291029
}
10301030
}

0 commit comments

Comments
 (0)