IssueRaiser

Doctests don't work in bin targets, non-public items

It's surprising that doctests sometimes don't run at all, and there's no warning about this. ```sh cargo new foo --bin ``` ```rust /// ```rust /// assert!(false); /// ``` fn main() { println!("Hello, world!"); } ``` ```sh cargo test --all ``` I'd expect the above to fail, but it looks like the doc-comment code is never ran. Even if I explicitly enable doctests for the binary: ```toml [[bin]] name = "foo" path = "src/main.rs" doctest = true ``` they still aren't run. (moved from https://github.com/rust-lang/cargo/issues/5477)

Posted by kornelski on May 15, 2018, 10:33 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments

reliability (Software)

Doctests don't work in bin targets, non-public items

kornelskiMay 15, 2018, 10:33 PM

It's surprising that doctests sometimes don't run at all, and there's no warning about this. ```sh cargo new foo --bin ``` ```rust /// ```rust /// assert!(false); /// ``` fn main() { println!("Hello, world!"); } ``` ```sh cargo test --all ``` I'd expect the above to fail, but it looks like the doc-comment code is never ran. Even if I explicitly enable doctests for the binary: ```toml [[bin]] name = "foo" path = "src/main.rs" doctest = true ``` they still aren't run. (moved from https://github.com/rust-lang/cargo/issues/5477)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue