Skip to content
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

Use intra-doc links in mem::manually_drop & mem::maybe_uninit #75214

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

chansuke
Copy link
Contributor

@chansuke chansuke commented Aug 6, 2020

This is partial fixes for #75080.

@rust-highfive
Copy link
Collaborator

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2020
@jyn514 jyn514 assigned jyn514 and unassigned cramertj Aug 6, 2020
@jyn514 jyn514 added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Aug 6, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once links are fixed and CI is passing :)

@@ -56,8 +56,7 @@ use crate::ptr;
/// working with [pinned] data, where reusing the memory without calling the destructor could lead
/// to Undefined Behaviour.
///
/// [`mem::zeroed`]: fn.zeroed.html
/// [`MaybeUninit<T>`]: union.MaybeUninit.html
/// [`mem::zeroed`]: MaybeUninit::<T>::zeroed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rustdoc will not resolve this <T>: #62834. But also I think it was meant to link to mem::zeroed, not MaybeUnint::zeroed, so you can leave it out altogether and it will still be resolved.

Suggested change
/// [`mem::zeroed`]: MaybeUninit::<T>::zeroed
/// [`MaybeUninit<T>`]: MaybeUninit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion.

/// [MaybeUninit]: MaybeUninit shows unresolved link error...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it with [MaybeUninit]: crate::mem::MaybeUninit

@@ -64,7 +64,7 @@ use crate::mem::ManuallyDrop;
/// *immediate* undefined behavior, but will cause undefined behavior with most
/// safe operations (including dropping it).
///
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html
/// [`Vec<T>`]: std::vec::Vec<T>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in core and Vec is in alloc. So this link will not resolve: #74481.

Suggested change
/// [`Vec<T>`]: std::vec::Vec<T>
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks...I was misunderstanding. I will fix it and squash the commit

@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2020
@@ -56,8 +56,7 @@ use crate::ptr;
/// working with [pinned] data, where reusing the memory without calling the destructor could lead
/// to Undefined Behaviour.
///
/// [`mem::zeroed`]: fn.zeroed.html
/// [`MaybeUninit<T>`]: union.MaybeUninit.html
/// [`MaybeUninit<T>`]: MaybeUninit
/// [pinned]: ../pin/index.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// [pinned]: ../pin/index.html
/// [pinned]: crate::pin

/// [`ManuallyDrop::into_inner`]: #method.into_inner
/// [`ptr::drop_in_place`]: ../ptr/fn.drop_in_place.html
/// [`into_inner`]: ManuallyDrop::into_inner
/// [`drop_in_place`]: ptr::drop_in_place
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ptr in scope in this module? If so this is fine, but otherwise it needs to be crate::ptr or super::ptr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that ptr was in scope since it doesn't give me results in unresolved link error... but anyway I will add crate. Thanks

@jyn514
Copy link
Member

jyn514 commented Aug 8, 2020

Broken links
  --> library/core/src/mem/manually_drop.rs:59:25
   |
59 | /// [`MaybeUninit<T>`]: MaybeUninit
   |                         ^^^^^^^^^^^ cannot be resolved, ignoring
   |
   = note: `-D intra-doc-link-resolution-failure` implied by `-D warnings`
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

error: `[mem::zeroed]` cannot be resolved, ignoring it.
  --> library/core/src/mem/manually_drop.rs:10:11
   |
10 | /// with [`mem::zeroed`] is undefined behavior.
   |           ^^^^^^^^^^^^^ cannot be resolved, ignoring
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

error: `[MaybeUninit]` cannot be resolved, ignoring it.
  --> library/core/src/mem/manually_drop.rs:59:25
   |
59 | /// [`MaybeUninit<T>`]: MaybeUninit
   |                         ^^^^^^^^^^^ cannot be resolved, ignoring
   |
   = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
``

</details>

Let me know if you have trouble fixing them.

@chansuke chansuke force-pushed the fix-intra-doc-links branch 2 times, most recently from 072a905 to d8536c3 Compare August 14, 2020 14:28
Comment on lines 119 to 120
/// [`drop`]: ManuallyDrop::drop
/// [`into_inner`]: ManuallyDrop::into_inner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything using drop or into_inner so you can remove these reference links :)

Suggested change
/// [`drop`]: ManuallyDrop::drop
/// [`into_inner`]: ManuallyDrop::into_inner

Comment on lines 151 to 152
/// [`into_inner`]: ManuallyDrop::into_inner
/// [`drop_in_place`]: crate::ptr::drop_in_place
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, the links don't seem to be used.

Suggested change
/// [`into_inner`]: ManuallyDrop::into_inner
/// [`drop_in_place`]: crate::ptr::drop_in_place

/// [`mem::zeroed`]: fn.zeroed.html
/// [`MaybeUninit<T>`]: union.MaybeUninit.html
/// [pinned]: ../pin/index.html
/// [`mem::zeroed`]: crate::mem::MaybeUninit::zeroed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this didn't mean to link to crate::mem::zeroed?

Suggested change
/// [`mem::zeroed`]: crate::mem::MaybeUninit::zeroed
/// [`mem::zeroed`]: crate::mem::zeroed

@jyn514
Copy link
Member

jyn514 commented Aug 14, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 14, 2020

📌 Commit 61866bc has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 14, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 14, 2020
Rollup of 17 pull requests

Successful merges:

 - rust-lang#73943 (Document the unsafe keyword)
 - rust-lang#74062 (deny(unsafe_op_in_unsafe_fn) in libstd/ffi/c_str.rs)
 - rust-lang#74185 (Remove liballoc unneeded explicit link)
 - rust-lang#74192 (Improve documentation on process::Child.std* fields)
 - rust-lang#74409 (Change Debug impl of SocketAddr and IpAddr to match their Display output)
 - rust-lang#75195 (BTreeMap: purge innocent use of into_kv_mut)
 - rust-lang#75214 (Use intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`)
 - rust-lang#75432 (Switch to intra-doc links in `std::process`)
 - rust-lang#75482 (Clean up E0752 explanation)
 - rust-lang#75501 (Move to intra doc links in std::ffi)
 - rust-lang#75509 (Tweak suggestion for `this` -> `self`)
 - rust-lang#75511 (Do not emit E0228 when it is implied by E0106)
 - rust-lang#75515 (Bump std's libc version to 0.2.74)
 - rust-lang#75517 (Promotion and const interning comments)
 - rust-lang#75519 (BTreeMap: refactor splitpoint and move testing over to unit test)
 - rust-lang#75530 (Switch to intra-doc links in os/raw/*.md)
 - rust-lang#75531 (Migrate unit tests of btree collections to their native breeding ground)

Failed merges:

r? @ghost
@bors bors merged commit ad8c5e1 into rust-lang:master Aug 15, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants