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

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

Merged
merged 1 commit into from Sep 17, 2021

Conversation

@hnj2
Copy link
Contributor

@hnj2 hnj2 commented Sep 7, 2021

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)]
pub struct SomeStruct;

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
Collaborator

@rust-highfive rust-highfive commented Sep 7, 2021

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-log-analyzer

This comment has been hidden.

@hnj2 hnj2 marked this pull request as ready for review Sep 8, 2021
@hnj2 hnj2 changed the title [WIP] Don't lint about missing code examples in derived traits Don't lint about missing code examples in derived traits Sep 8, 2021
@hnj2
Copy link
Contributor Author

@hnj2 hnj2 commented Sep 16, 2021

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

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Sep 16, 2021

This is a really nice fix, thanks!

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

@bors: r+

@bors
Copy link
Contributor

@bors bors commented Sep 16, 2021

📌 Commit 5f464bb has been approved by GuillaumeGomez

bors added a commit to rust-lang-ci/rust that referenced this issue 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:master Sep 17, 2021
10 checks passed
@rustbot rustbot added this to the 1.57.0 milestone Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

7 participants