Skip to content

Use intra-doc links in core::macros - #75927

Merged
bors merged 1 commit into
rust-lang:masterfrom
camelid:intra-doc-links-for-core-macros
Aug 28, 2020
Merged

Use intra-doc links in core::macros#75927
bors merged 1 commit into
rust-lang:masterfrom
camelid:intra-doc-links-for-core-macros

Conversation

@camelid

Copy link
Copy Markdown
Member

Part of #75080.

Also cleaned up some things.

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

@rustbotrustbot 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 T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 25, 2020
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @cramertj

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2020
@camelid

camelid commented Aug 25, 2020

Copy link
Copy Markdown
MemberAuthor

NOTE: the intra-doc links in panic.mdmust be checked by hand before this is merged. I'll need to get my local build going :)

From @jyn514:

If you can get rustdoc to create the links for markdown files, I think it's fine to convert them too, but I'd want to make sure the pass is actually being run and the links aren't silently being ignored.

@jyn514jyn514 removed the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Aug 26, 2020
@jyn514

Copy link
Copy Markdown
Member

I decided that T-rustdoc isn't very helpful for these - the other labels are still great though :)
#75917 (comment)

@camelid

Copy link
Copy Markdown
MemberAuthor

Makes sense to me :)

@jyn514jyn514 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This uses doc(include = "panic.md"), so it should work fine when included. I'm all for verifying that though :)

#[doc(include = "panic.md")]

Comment threadlibrary/core/src/macros/mod.rs Outdated
Comment threadlibrary/core/src/macros/panic.md Outdated
Comment threadlibrary/core/src/macros/panic.md Outdated
Comment threadlibrary/core/src/macros/panic.md Outdated
Comment threadlibrary/core/src/macros/panic.md Outdated
@camelid

Copy link
Copy Markdown
MemberAuthor

Hmm, why is this happening?

 error: `[format]` cannot be resolved, ignoring it.
--> library/core/src/macros/mod.rs:1:1
|
1 | #[doc(include = "panic.md")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D intra-doc-link-resolution-failure` implied by `-D warnings`
= note: the link appears in this line:
[`format!`] syntax for building a string.
^^^^^^^^^
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: `[format]` cannot be resolved, ignoring it.
--> library/core/src/macros/mod.rs:729:39
|
729 | /// All other formatting macros ([`format!`], [`write!`], [`println!`], etc) are
| ^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: `[println]` cannot be resolved, ignoring it.
--> library/core/src/macros/mod.rs:729:64
|
729 | /// All other formatting macros ([`format!`], [`write!`], [`println!`], etc) are
| ^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
error: aborting due to 3 previous errors

@jyn514

Copy link
Copy Markdown
Member

format is in alloc, because it allocates: https://doc.rust-lang.org/src/alloc/macros.rs.html#105-110. println is std-only because it does IO: https://doc.rust-lang.org/src/std/macros.rs.html#94-99

@camelid
camelidforce-pushed the intra-doc-links-for-core-macros branch from 89949c4 to 99704e7CompareAugust 26, 2020 00:34
Comment threadlibrary/core/src/macros/mod.rs Outdated

@jyn514jyn514 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me with nit addressed and CI passing

Comment threadlibrary/core/src/macros/panic.md Outdated
@jyn514

Copy link
Copy Markdown
Member
error: `[Box]` cannot be resolved, ignoring it.
error: `[Any]` cannot be resolved, ignoring it.
error: `[format]` cannot be resolved, ignoring it.

Oops, my fault, sorry.

@camelid

Copy link
Copy Markdown
MemberAuthor

Do I have to use a non-intra-doc link for Box since it requires allocation?

@jyn514

Copy link
Copy Markdown
Member

Do I have to use a non-intra-doc link for Box since it requires allocation?

Yes, Any is in core though: https://doc.rust-lang.org/core/any/trait.Any.html

@camelid

Copy link
Copy Markdown
MemberAuthor

That's what I thought. Should be all done now!

@jyn514

Copy link
Copy Markdown
Member

Do you mind squashing the commits?

Also cleaned up some things and added a few more links.
@camelid
camelidforce-pushed the intra-doc-links-for-core-macros branch from e11acd5 to 511ee05CompareAugust 26, 2020 01:46
@camelid

Copy link
Copy Markdown
MemberAuthor

Squashed! :)

@jyn514

Copy link
Copy Markdown
Member

@bors r+ rollup

Finally good to go 😆

@bors

bors commented Aug 26, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 511ee05 has been approved by jyn514

@borsbors 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 Aug 26, 2020
Comment on lines +27 to +28
[ounwrap]: Option::unwrap
[runwrap]: Result::unwrap

@pickfirepickfireAug 26, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just make the original version Option::unwrap and Result::unwrap by tweaking the text a bit?

@jyn514jyn514Aug 26, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's make that a follow-up PR, this one's been through enough 😆

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I forgot my the last time I commented on a PR that needs a follow up PR, I wanted to go back to that but I forgot which PR is it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@pickfire

Copy link
Copy Markdown
Contributor

@pickfire clean up text when this is merged.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 28, 2020
…albini
Rollup of 12 pull requests
Successful merges:
- rust-lang#75330 (Improve rendering of crate features via doc(cfg))
- rust-lang#75927 (Use intra-doc links in `core::macros`)
- rust-lang#75941 (Clean up E0761 explanation)
- rust-lang#75943 (Fix potential UB in align_offset doc examples)
- rust-lang#75946 (Error use explicit intra-doc link and fix text)
- rust-lang#75955 (Use intra-doc links in `core::future::future` and `core::num::dec2flt`)
- rust-lang#75967 (Fix typo in `std::hint::black_box` docs)
- rust-lang#75972 (Fix ICE due to carriage return w/ multibyte char)
- rust-lang#75989 (Rename rustdoc/test -> rustdoc/doctest)
- rust-lang#75996 (fix wording in release notes)
- rust-lang#75998 (Add InstrProfilingPlatformFuchsia.c to profiler_builtins)
- rust-lang#76000 (Adds --bless support to test/run-make-fulldeps)
Failed merges:
r? @ghost
@bors
bors merged commit 521b205 into rust-lang:masterAug 28, 2020
@cuvipercuviper added this to the 1.48.0 milestone Nov 17, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameS-waiting-on-borsStatus: 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.

8 participants

@camelid@rust-highfive@jyn514@bors@pickfire@cuviper@cramertj@rustbot