Open
Description
Problem
As currently stands, there's an inconsistency in doctests running with debug_assertions
on even when code was compiled through cargo test --release
. I would've expected that cargo test --release
means that the doctests get compiled in release mode as well, but that doesn't appear to be the case.
Steps
//! Here's a doctest:
//!
//! ```rust
//! use doctest_da::my_function;
//!
//! if cfg!(debug_assertions) {
//! assert!(my_function().is_ok());
//! } else {
//! assert!(my_function().is_err());
//! }
//! ```
pub fn my_function() -> Result<(), ()>{
if cfg!(debug_assertions) {
Ok(())
} else {
Err(())
}
}
Notes
I'm a bit confused on where exactly this issue may need to be filed. It seems related to #5777 and #5218, but because this hits doctests, #4669 and rust-lang/rust#45599 may take precedence. Let me know if I should move.
Output of cargo version
:
cargo 1.32.0 (8610973aa 2019-01-02)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status