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

Return &T / &mut T in ManuallyDrop Deref(Mut) impl #55485

Merged
merged 1 commit into from Nov 22, 2018

Conversation

Projects
None yet
7 participants
@petertodd
Contributor

petertodd commented Oct 29, 2018

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

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
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Oct 29, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aidanhs (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@Centril

This comment has been minimized.

Contributor

Centril commented Oct 30, 2018

We should land this PR, but...

...To me this feels like a bug in rustdoc that you see &<ManuallyDrop<T> as Deref>::Target and not &Self::Target as was written. cc @QuietMisdreavus

@QuietMisdreavus

This comment has been minimized.

Member

QuietMisdreavus commented Oct 30, 2018

Humorously enough, the impl looks just fine in core's version of the Deref docs, so it's a problem with how the information comes out in the re-export.

image

I can try looking into this over the next few days, but "information gets weird when something is re-exported" is a common problem in rustdoc, sadly.

@TimNN

This comment has been minimized.

Contributor

TimNN commented Nov 13, 2018

Ping from triage @QuietMisdreavus / @Centril / @aidanhs: Do you think it is worth it to merge this PR as is, while the rustdoc issue is figured out?

@Centril

This comment has been minimized.

Contributor

Centril commented Nov 13, 2018

Yes.

@QuietMisdreavus

This comment has been minimized.

Member

QuietMisdreavus commented Nov 14, 2018

Yes, i think this makes the docs better and allows us to take more time to investigate the underlying issue (which haven't taken the opportunity to investigate >_>).

@TimNN

This comment has been minimized.

Contributor

TimNN commented Nov 20, 2018

@bors r+ rollup

@bors

This comment has been minimized.

Contributor

bors commented Nov 20, 2018

📌 Commit bc18857 has been approved by TimNN

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 22, 2018

Rollup merge of rust-lang#55485 - petertodd:2018-10-manuallydrop-dere…
…f, 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)

bors added a commit that referenced this pull request Nov 22, 2018

Auto merge of #56155 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - #55367 (lint if a private item has doctests)
 - #55485 (Return &T / &mut T in ManuallyDrop Deref(Mut) impl)
 - #55784 (Clarifying documentation for collections::hash_map::Entry::or_insert)
 - #55961 (Fix VecDeque pretty-printer)
 - #55980 (Suggest on closure args count mismatching with pipe span)
 - #56002 (fix #55972: Erroneous self arguments on bare functions emit subpar compilation error)
 - #56063 (Update any.rs documentation using keyword dyn)
 - #56067 (Add SGX target to rustc)
 - #56078 (Fix error message for `-C panic=xxx`.)
 - #56106 (Remove some incorrect doc comments)
 - #56126 (core/benches/num: Add `from_str/from_str_radix()` benchmarks)

Failed merges:

r? @ghost

@bors bors merged commit bc18857 into rust-lang:master Nov 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@petertodd petertodd deleted the petertodd:2018-10-manuallydrop-deref branch Nov 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment