Skip to content

2024 doctests don't show stdout when failing #140289

Closed
@GuillaumeGomez

Description

@GuillaumeGomez

Can be seen with:

//! ```
//! println!("######## from a DOC TEST ########");
//! assert_eq!("doc", "test");
//! ```

Before 2024:

running 1 test
test src/lib.rs - (line 1) ... FAILED

failures:

---- src/lib.rs - (line 1) stdout ----
Test executable failed (exit status: 101).

stdout:
######## from a DOC TEST ########

stderr:

thread 'main' panicked at src/lib.rs:4:1:
assertion `left == right` failed
  left: "doc"
 right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With 2024:

running 1 test
test src/lib.rs - (line 1) ... FAILED

failures:

---- src/lib.rs - (line 1) stdout ----

thread 'main' panicked at /tmp/rustdoctestMXBeHp/doctest_bundle_2024.rs:7:1:
assertion `left == right` failed
  left: "doc"
 right: "test"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Initially reported here.

cc @slluk

Metadata

Metadata

Labels

A-doctestsArea: Documentation tests, run by rustdocC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions