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
- [BUG] Cowork (Windows): all Plan9 shares fail with "Plan9 mount failed: invalid argument" after Windows update KB5124008 (26200.9445) — uninstalling the KB fixe
- Feature Request: Auto-resume CLI session when usage limit resets
- Please deobfuscate the Python
- [Bug] MLX version of Gemma 4 26B fails to load: "Model type gemma4 not supported" (macOS)
- # 233 Developers Discussed Abandoning the Office Add-in Platform — An Open Letter on the Office.js Stability, Security & Trust Crisis
- [FEATURE] Allow users to configure which shell the Bash tool uses or inherit initial shell
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
reliability (Software)
[BUG] Cowork (Windows): all Plan9 shares fail with "Plan9 mount failed: invalid argument" after Windows update KB5124008 (26200.9445) — uninstalling the KB fixe
Feature Request: Auto-resume CLI session when usage limit resets
Please deobfuscate the Python
[Bug] MLX version of Gemma 4 26B fails to load: "Model type gemma4 not supported" (macOS)
# 233 Developers Discussed Abandoning the Office Add-in Platform — An Open Letter on the Office.js Stability, Security & Trust Crisis
[FEATURE] Allow users to configure which shell the Bash tool uses or inherit initial shell
Admin Materials and Surfaces
AMD Support
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)
Comments (0)
No comments yet. Start the discussion.