Skip to content

Don't lint about missing code examples in derived traits - #88735

Merged
bors merged 1 commit into
rust-lang:masterfrom
hnj2:patch-1
Sep 17, 2021
Merged

Don't lint about missing code examples in derived traits#88735
bors merged 1 commit into
rust-lang:masterfrom
hnj2:patch-1

Conversation

@hnj2

@hnj2hnj2 commented Sep 7, 2021

Copy link
Copy Markdown
Contributor

When the missing_doc_code_examples lint is performed it also requires that derived Trait implementations have a code example for each member etc., which causes undesirable behavior.

Examples

With missing_doc_code_examples enable we are not able to use the Clone derive macro due to the generated code not being documented:

#[deny(rustdoc::missing_doc_code_examples)]/// docs/// ```/// let s = SomeStruct;/// ```#[derive(Clone)]pubstructSomeStruct;

yields:

 Documenting testt v0.1.0 (<redacted>)
error: missing code example in this documentation
--> src/lib.rs:7:10
|
7 | #[derive(Clone)]
| ^^^^^
|
note: the lint level is defined here
--> src/lib.rs:1:8
|
1 | #[deny(rustdoc::missing_doc_code_examples)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: missing code example in this documentation
--> src/lib.rs:7:10
|
7 | #[derive(Clone)]
| ^^^^^
error: could not document `testt`
Caused by:
process didn't exit successfully: `rustdoc ...

closes#81775

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @CraftSpider (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2021
@rust-log-analyzer

This comment has been minimized.

@hnj2
hnj2 marked this pull request as ready for review September 8, 2021 09:13
@hnj2hnj2 changed the title [WIP] Don't lint about missing code examples in derived traitsDon't lint about missing code examples in derived traitsSep 8, 2021
@hnj2

hnj2 commented Sep 16, 2021

Copy link
Copy Markdown
ContributorAuthor

Hey, since you reviewed #88745 could you take a look at this? Thanks

r? @GuillaumeGomez

@GuillaumeGomezGuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 16, 2021
@GuillaumeGomez

Copy link
Copy Markdown
Member

This is a really nice fix, thanks!

Don't hesitate to ping me or @jyn514 sooner next time. ;)

@bors: r+

@bors

bors commented Sep 16, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 5f464bb has been approved by GuillaumeGomez

@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 Sep 16, 2021
@JohnTitorJohnTitor mentioned this pull request Sep 17, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2021
Rollup of 10 pull requests
Successful merges:
- rust-lang#86382 (Make diagnostics clearer for `?` operators)
- rust-lang#87529 (Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types)
- rust-lang#88339 (Add TcpListener::into_incoming and IntoIncoming)
- rust-lang#88735 (Don't lint about missing code examples in derived traits)
- rust-lang#88751 (Couple of changes to FileSearch and SearchPath)
- rust-lang#88883 (Move some tests to more reasonable directories - 7)
- rust-lang#88887 (Const Deref)
- rust-lang#88911 (Improve error message for type mismatch in generator arguments)
- rust-lang#89014 (PassWrapper: handle separate Module*SanitizerPass)
- rust-lang#89033 (Set the library path in sysroot-crates-are-unstable)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 758c7bc into rust-lang:masterSep 17, 2021
@rustbotrustbot added this to the 1.57.0 milestone Sep 17, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustdoc shouldn't lint about missing code examples in derived traits

7 participants

@hnj2@rust-highfive@rust-log-analyzer@GuillaumeGomez@bors@CraftSpider@rustbot