Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Dec 31, 2020

Conversation

m-ou-se
Copy link
Member

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

This replaces about 200 cases of

        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

        /// 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

@Aaron1011

This comment has been minimized.

@m-ou-se

This comment has been minimized.

@m-ou-se m-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
@jyn514 jyn514 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
Member

jyn514 commented Nov 18, 2020

This is so much nicer ❤️

@bors

This comment has been minimized.

@m-ou-se m-ou-se force-pushed the bye-bye-doc-comment-hack branch from fba6ee3 to d9dff70 Compare November 24, 2020 22:43
@m-ou-se m-ou-se force-pushed the bye-bye-doc-comment-hack branch from d9dff70 to 0f00fbf Compare December 30, 2020 14:35
@rust-log-analyzer

This comment has been minimized.

@jyn514

This comment has been minimized.

@m-ou-se m-ou-se force-pushed the bye-bye-doc-comment-hack branch from 0f00fbf to 356a680 Compare December 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-se force-pushed the bye-bye-doc-comment-hack branch from 356a680 to 7b68367 Compare December 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
Member Author

m-ou-se commented Dec 30, 2020

r? @dtolnay

@rust-log-analyzer

This comment has been minimized.

@m-ou-se m-ou-se force-pushed the bye-bye-doc-comment-hack branch from 2d180cc to 5694b8e Compare December 30, 2020 21:49
@m-ou-se m-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
/// Basic usage:
///
/// ```
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX, ", stringify!($Max), ");")]
Copy link
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 ❤️

@jyn514
Copy link
Member

jyn514 commented Dec 30, 2020

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
Member Author

m-ou-se commented Dec 30, 2020

Thanks for the review!

@bors r=jyn514

@bors
Copy link
Collaborator

bors commented Dec 30, 2020

📌 Commit 4614cdd 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2020
@m-ou-se m-ou-se assigned jyn514 and unassigned dtolnay Dec 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
Copy link
Collaborator

bors commented Dec 31, 2020

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

@bors
Copy link
Collaborator

bors commented Dec 31, 2020

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 31, 2020
@bors bors merged commit 8b002d5 into rust-lang:master Dec 31, 2020
@rustbot rustbot 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/.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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. T-libs Relevant 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