Skip to content

rustdoc warns main is never used #13894

Closed
@gifnksm

Description

@gifnksm

rustdoc warns that main is never used.

// hello.rs
#![crate_id="hello"]

fn main() {}
$ rustdoc hello.rs
hello.rs:3:1: 3:13 warning: code is never used: `main`, #[warn(dead_code)] on by default
hello.rs:3 fn main() {}
           ^~~~~~~~~~~~

I think rustdoc shouldn't warn about it, because rustc doesn't warn.

$ rustc hello.rs
# no output

If the main is pub, rustdoc doesn't warn about it. Shoulud all mains mark as pub?

// pubhello.rs
#![crate_id="hello"]

pub fn main() {}
$ rustdoc pubhello.rs
# no output
$ rustc --version
rustc 0.11-pre (9f836d5 2014-05-01 16:06:48 -0700)
host: x86_64-unknown-linux-gnu

$ rustdoc --version
rustdoc 0.11-pre (9f836d5 2014-05-01 16:06:48 -0700)
host: x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions