Description
Update 2021-12-27: More minimized MCVE at repo here (also linked from comment below.)
I tried this code (note that the crate name needs to match its usage in the doc test to reproduce the bug properly):
# Cargo.toml
[package]
name = "a64_doctestfail"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "0.2", features = ["full"] }
[profile.release]
lto = true
// lib.rs
pub fn bad() {
let _ = tokio::runtime::Builder::new();
}
/// ```
/// use a64_doctestfail;
/// ```
pub struct X;
And then ran cargo --release --doc
.
I expected to see this happen:
(Working behavior from 1.56.1, witnessed via nightly-2021-10-13)
% cargo +nightly-2021-10-13 test --release --doc
Compiling a64_doctestfail v0.1.0 (/Users/pnkfelix/Dev/Rust/a64_doctestfail)
Finished release [optimized] target(s) in 0.09s
Doc-tests a64_doctestfail
running 1 test
test src/lib.rs - X (line 7) ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.19s
Instead, this happened:
(Broken behavior from 1.57.0, witnessed via nightly-2021-10-14)
% cargo +nightly-2021-10-14 test --release --doc
Finished release [optimized] target(s) in 0.01s
Doc-tests a64_doctestfail
running 1 test
test src/lib.rs - X (line 7) ... FAILED
failures:
---- src/lib.rs - X (line 7) stdout ----
Couldn't compile the test.
failures:
src/lib.rs - X (line 7)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.68s
error: test failed, to rerun pass '--doc'
Meta
rustc +nightly-2021-10-14 --version --verbose
:
rustc 1.57.0-nightly (dfc5add 2021-10-13)
binary: rustc
commit-hash: dfc5add
commit-date: 2021-10-13
host: aarch64-apple-darwin
release: 1.57.0-nightly
LLVM version: 13.0.0
`rustc +stable --version --verbose`:
rustc 1.57.0 (f1edd04 2021-11-29)
binary: rustc
commit-hash: f1edd04
commit-date: 2021-11-29
host: aarch64-apple-darwin
release: 1.57.0
LLVM version: 13.0.0