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

Hide generated dummy const in rustdoc #1768

Merged
merged 1 commit into from Apr 3, 2020
Merged

Hide generated dummy const in rustdoc #1768

merged 1 commit into from Apr 3, 2020

Conversation

robo9k
Copy link
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
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
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.

None yet

2 participants