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

More intra doc links #77875

Merged
merged 11 commits into from
Dec 1, 2020
Merged

More intra doc links #77875

merged 11 commits into from
Dec 1, 2020

Conversation

poliorcetics
Copy link
Contributor

Helps with #75080.

I did a commit by group of file, I can squash if wanted.

@rustbot modify labels: T-doc, A-intra-doc-links

r? @jyn514

@rustbot rustbot 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 Oct 12, 2020
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 12, 2020
library/core/src/cell.rs Show resolved Hide resolved
/// # Safety
///
/// This function is unsafe, as it may construct invalid `char` values.
///
/// For a safe version of this function, see the [`from_u32`] function.
///
/// [`from_u32`]: #method.from_u32
/// [`from_u32`]: prim@char::from_u32()
Copy link
Member

Choose a reason for hiding this comment

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

Oof, this is a bug in intra-doc links. prim should apply to the whole item, not to the type.

warning: incompatible link kind for `char::from_u32`
 --> tmp.rs:1:6
  |
1 | /// [char::from_u32()]
  |      ^^^^^^^^^^^^^^^^ help: to link to the builtin type, prefix with `prim@`: `prim@char::from_u32`
  = note: this link resolved to a builtin type, which is not a function

That said, I guess it works as-is, it's just inconsistent with the rest of intra-doc links ... @Manishearth what do you think? I think if we made it apply to the whole item there'd be no way to disambiguate between primitives and modules for associated items.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I think it could still use core::primitive::char::from_u32 actually. That seems better anyway to remove the ambiguity.

I didn't know core::primitive existed when I added prim@ ... maybe we should just get rid of that disambiguator altogether to be consistent with rustc_resolve?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you end up using core::primitive please ping me so I can update intraconv :)

library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/const_ptr.rs Outdated Show resolved Hide resolved
library/core/src/ptr/mut_ptr.rs Outdated Show resolved Hide resolved
@jyn514
Copy link
Member

jyn514 commented Oct 13, 2020

Oh sorry - the current failures are another bug that was recently fixed: #77267. I guess this has to wait until the beta bump then :/

@poliorcetics
Copy link
Contributor Author

Now that #77267 has been closed, I rebased on master to see if this is now working.

@poliorcetics
Copy link
Contributor Author

This fails on the crate::primitive::char:: links in core because it seems rustdoc is not generating the links when in core

@bors
Copy link
Contributor

bors commented Nov 8, 2020

☔ The latest upstream changes (presumably #78874) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@poliorcetics
Copy link
Contributor Author

I couldn't transform links like those so I simply let them as they are for now so that this PR can be merged

-    /// [`len_utf8()`]: #method.len_utf8
+    /// [`len_utf8()`]: crate::primitive::char::len_utf8()
OR
+    /// [`len_utf8()`]: prim@char::len_utf8()
OR
+    /// [`len_utf8()`]: char::len_utf8()

@jyn514
Copy link
Member

jyn514 commented Nov 19, 2020

It looks like this is still broken unfortunately.

std/primitive.f64.html:705: broken link - std/prim@f64::to_be_bytes()
std/primitive.f64.html:705: broken link - std/prim@f64::to_le_bytes()
std/primitive.f64.html:719: broken link - std/prim@f64::to_ne_bytes()
std/primitive.f64.html:745: broken link - std/prim@f64::from_be_bytes()
std/primitive.f64.html:745: broken link - std/prim@f64::from_le_bytes()
std/string/struct.String.html:1981: broken link - std/string/prim@str::to_ascii_uppercase()
std/string/struct.String.html:1993: broken link - std/string/prim@str::to_ascii_lowercase()
std/primitive.f32.html:728: broken link - std/prim@f32::to_be_bytes()
std/primitive.f32.html:728: broken link - std/prim@f32::to_le_bytes()
std/primitive.f32.html:742: broken link - std/prim@f32::to_ne_bytes()
std/primitive.f32.html:768: broken link - std/prim@f32::from_be_bytes()
std/primitive.f32.html:768: broken link - std/prim@f32::from_le_bytes()
std/primitive.str.html:1223: broken link - std/prim@str::to_ascii_uppercase()
std/primitive.str.html:1235: broken link - std/prim@str::to_ascii_lowercase()
std/cell/struct.RefCell.html:154: broken link - std/cell/Self::borrow_mut()
std/cell/struct.RefCell.html:156: broken link - std/cell/Self::borrow_mut()
std/cell/struct.RefCell.html:166: broken link - std/cell/Self::get_mut()
std/cell/struct.UnsafeCell.html:150: broken link - std/cell/Self::get()
thread 'main' panicked at 'found some broken links', src/tools/linkchecker/main.rs:109:9

@bors

This comment has been minimized.

@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 Nov 23, 2020
@poliorcetics
Copy link
Contributor Author

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 23, 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.

r=me with Cargo.lock updated

Cargo.lock Outdated Show resolved Hide resolved
@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 Nov 29, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 29, 2020

std/cell/struct.RefCell.html:166: broken link - std/cell/Self::get_mut()

I think this might be fixed by #76467. I'll add a test case.

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

@bors r+

Thanks for sticking with this!

@bors
Copy link
Contributor

bors commented Nov 30, 2020

📌 Commit 5bdd640 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 Nov 30, 2020
@bors
Copy link
Contributor

bors commented Nov 30, 2020

⌛ Testing commit 5bdd640 with merge 796a2a9bbe7614610bd67d4cd0cf0dfff0468778...

@bors
Copy link
Contributor

bors commented Dec 1, 2020

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 1, 2020
@jyn514
Copy link
Member

jyn514 commented Dec 1, 2020

@bors retry

@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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2020
@bors
Copy link
Contributor

bors commented Dec 1, 2020

⌛ Testing commit 5bdd640 with merge becec6d...

@bors
Copy link
Contributor

bors commented Dec 1, 2020

☀️ Test successful - checks-actions
Approved by: jyn514
Pushing becec6d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 1, 2020
@bors bors merged commit becec6d into rust-lang:master Dec 1, 2020
@rustbot rustbot added this to the 1.50.0 milestone Dec 1, 2020
@poliorcetics poliorcetics deleted the more-intra-doc-links branch December 1, 2020 10:26
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 merged-by-bors This PR was explicitly merged by bors. 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.

5 participants