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

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

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.

@rust-log-analyzer

This comment has been minimized.

@jyn514

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@m-ou-se

This comment has been minimized.

@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 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
library/core/src/num/int_macros.rs Show resolved Hide resolved
/// 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 ❤️

library/core/src/num/shells/int_macros.rs Outdated Show resolved Hide resolved
library/core/src/num/shells/int_macros.rs Outdated Show resolved Hide resolved
@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
Contributor

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
Contributor

bors commented Dec 31, 2020

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

@bors
Copy link
Contributor

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