Skip to content

Remove all doc_comment!{} hacks by using #[doc = expr] where needed. - #79150

Merged
bors merged 3 commits into
rust-lang:masterfrom
m-ou-se:bye-bye-doc-comment-hack
Dec 31, 2020
Merged

Remove all doc_comment!{} hacks by using #[doc = expr] where needed.#79150
bors merged 3 commits into
rust-lang:masterfrom
m-ou-se:bye-bye-doc-comment-hack

Conversation

@m-ou-se

@m-ou-sem-ou-se commented Nov 17, 2020

Copy link
Copy Markdown
Member

This replaces about 200 cases of

doc_comment!{
concat!("The smallest value that can be represented by this integer type.# ExamplesBasic usage:```", $Feature,"assert_eq!(", stringify!($SelfT),"::MIN, ", stringify!($Min),");",
$EndFeature,"```"),
#[stable(feature = "assoc_int_consts", since = "1.43.0")]pubconstMIN:Self = !0 ^ ((!0as $UnsignedT) >> 1)asSelf;}

by

/// The smallest value that can be represented by this integer type.////// # Examples////// Basic usage:////// ```#[doc = concat!("assert_eq!(", stringify!($SelfT),"::MIN, ", stringify!($Min),");")]/// ```#[stable(feature = "assoc_int_consts", since = "1.43.0")]pubconstMIN:Self = !0 ^ ((!0as $UnsignedT) >> 1)asSelf;

Note: For a usable diff, make sure to enable 'ignore whitspace': https://github.com/rust-lang/rust/pull/79150/files?diff=unified&w=1

@Aaron1011

This comment has been minimized.

@m-ou-se

This comment has been minimized.

@m-ou-sem-ou-se added C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Nov 17, 2020
@jyn514jyn514 added T-libs Relevant to the library team, which will review and decide on the PR/issue. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Nov 18, 2020
@jyn514

Copy link
Copy Markdown
Member

This is so much nicer ❤️

@bors

This comment has been minimized.

@m-ou-se
m-ou-seforce-pushed the bye-bye-doc-comment-hack branch from fba6ee3 to d9dff70CompareNovember 24, 2020 22:43
@m-ou-se
m-ou-seforce-pushed the bye-bye-doc-comment-hack branch from d9dff70 to 0f00fbfCompareDecember 30, 2020 14:35
@rust-log-analyzer

This comment has been minimized.

@jyn514

This comment has been minimized.

@m-ou-se
m-ou-seforce-pushed the bye-bye-doc-comment-hack branch from 0f00fbf to 356a680CompareDecember 30, 2020 14:42
@rust-log-analyzer

This comment has been minimized.

@m-ou-se

This comment has been minimized.

@m-ou-se
m-ou-seforce-pushed the bye-bye-doc-comment-hack branch from 356a680 to 7b68367CompareDecember 30, 2020 21:30
@rust-log-analyzer

This comment has been minimized.

@m-ou-se
m-ou-se marked this pull request as ready for review December 30, 2020 21:42
@m-ou-se

Copy link
Copy Markdown
MemberAuthor

r? @dtolnay

@rust-log-analyzer

This comment has been minimized.

@m-ou-se
m-ou-seforce-pushed the bye-bye-doc-comment-hack branch from 2d180cc to 5694b8eCompareDecember 30, 2020 21:49
@m-ou-sem-ou-se added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Dec 30, 2020
Comment threadlibrary/core/src/num/int_macros.rs
/// Basic usage:
///
/// ```
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX, ", stringify!($Max), ");")]

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 will make #75807 so much easier ❤️

Comment threadlibrary/core/src/num/shells/int_macros.rs Outdated
Comment threadlibrary/core/src/num/shells/int_macros.rs Outdated
@jyn514

Copy link
Copy Markdown
Member

For posterity, you can review this by adding #![doc(html_no_source)] to core/src/lib.rs, running x.py doc --stage 0 library/core, then running https://github.com/Nemo157/dotfiles/blob/master/bin/tidy-rustdoc on the output. Then you can apply the changes and diff them with diff --color=always -r core-before-tidy core-after-tidy/ | less -R

@m-ou-se

Copy link
Copy Markdown
MemberAuthor

Thanks for the review!

@bors r=jyn514

@bors

bors commented Dec 30, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 4614cdd 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 Dec 30, 2020
@m-ou-sem-ou-se assigned jyn514 and unassigned dtolnayDec 30, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Dec 31, 2020
…=jyn514
Remove all doc_comment!{} hacks by using #[doc = expr] where needed.
This replaces about 200 cases of
`````rust
doc_comment! {
concat!("The smallest value that can be represented by this integer type.
# Examples
Basic usage:
```
", $Feature, "assert_eq!(", stringify!($SelfT), "::MIN, ", stringify!($Min), ");",
$EndFeature, "
```"),
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;
}
`````
by
```rust
/// The smallest value that can be represented by this integer type.
///
/// # Examples
///
/// Basic usage:
///
/// ```
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN, ", stringify!($Min), ");")]
/// ```
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;
```
---
**Note:** For a usable diff, make sure to enable 'ignore whitspace': https://github.com/rust-lang/rust/pull/79150/files?diff=unified&w=1
@bors

bors commented Dec 31, 2020

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4614cdd with merge 8b002d5...

@bors

bors commented Dec 31, 2020

Copy link
Copy Markdown
Collaborator

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

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Dec 31, 2020
@bors
bors merged commit 8b002d5 into rust-lang:masterDec 31, 2020
@rustbotrustbot added this to the 1.51.0 milestone Dec 31, 2020
@m-ou-se
m-ou-se deleted the bye-bye-doc-comment-hack branch December 31, 2020 11:23
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 19, 2021
Remove unnecessary `forward_inner_docs` hack
and replace it with `extended_key_value_attributes` feature.
This is rust-lang#79150, but for compiler/.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 19, 2021
Remove unnecessary `forward_inner_docs` hack
and replace it with `extended_key_value_attributes` feature.
This is rust-lang#79150, but for compiler/.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 19, 2021
Remove unnecessary `forward_inner_docs` hack
and replace it with `extended_key_value_attributes` feature.
This is rust-lang#79150, but for compiler/.
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 toolsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@m-ou-se@Aaron1011@jyn514@bors@rust-log-analyzer@dtolnay@rustbot