Skip to content

Hide generated dummy const in rustdoc#1768

Merged
dtolnay merged 1 commit intoserde-rs:masterfrom
robo9k:dummy-const-hidden-doc
Apr 3, 2020
Merged

Hide generated dummy const in rustdoc#1768
dtolnay merged 1 commit intoserde-rs:masterfrom
robo9k:dummy-const-hidden-doc

Conversation

@robo9k
Copy link
Copy Markdown
Contributor

@robo9k robo9k commented Apr 3, 2020

When creating a binary crate with a src/main.rs and #[derive(Deserialize, Serialize)], running cargo doc on it will result in new doc items for generated constants:

use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
struct Dummy {
}

fn main() {
    println!("Hello, world!");
}

rustdoc

This is because Cargo runs with --document-private-items internally for src/main.rs. If you put the same code in a src/lib.rs the private items will not be documented by default, so you won't see them there for default cargo doc.
The items will be visible both for src/lib.rs and src/main.rs if the struct itself is pub.

I believe the generated _IMPL_{}_FOR_{} constants should not be visible in rustdoc and this merge request seems to fix the issue for me.

Copy link
Copy Markdown
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit 645f672 into serde-rs:master Apr 3, 2020
@dtolnay
Copy link
Copy Markdown
Member

dtolnay commented Apr 3, 2020

Published in 1.0.106.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants