-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
cargo test
does not run doctests for cdylib
#4717
Comments
This is a limitation of rustdoc, not Cargo, so I think you'll want to open an issue against rust-lang/rust |
As there hasn't been any activity here in over 6 months I've marked this as stale and if no further activity happens for 7 days I will close it. I'm a bot so this may be in error! If this issue should remain open, could someone (the author, a team member, or any interested party) please comment to that effect? The team would be especially grateful if such a comment included details such as:
Thank you for contributing! (The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.) If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable! |
As I didn't see any updates in 30 days I'm going to close this. Please see the previous comment for more information! |
This is effectively a dupe of #2442. However, #2442 was closed without action. Having
cargo test
silently not run doctests for cdylib and other non-rlib crate types is a papercut. It is confusing for new users that do not know the implementation details of doctests.A user should be informed of which tests are not being run, why, and how to resolve. This would cut down on time spent discovering why doctests are not run. Configuration should allow these messages to be disabled.
Discovery Process for Current Behavior
To debug why doctests were not being run, I had to search the cargo source for "Doc-tests" which led me to:
cargo/src/cargo/core/manifest.rs
Line 471 in 8be175e
Current Behavior
Running
cargo test --doc
on a new rlib successfully runs doctests:Running
cargo test --doc
on a new cdylib silently fails with:Expected Behavior
Running
cargo test --doc
on a cdylib should inform the user that doctests were not run:Ideally, the message should inform the user of alternatives. I don't know what these are yet. Maybe adding "rlib" to crate-type in addition to what is already there. Or break up the code base into multiple crates so that doctest can be run on a subset.
Cargo Version
The text was updated successfully, but these errors were encountered: