Skip to content

rustdoc --test --preserve-doctests --no-run produces empty non-executable files #88110

Closed
@jsgf

Description

@jsgf

I tried this code:

t.rs:

/// Fungle the foople.
/// ```
/// t::foople();
/// ```
pub fn foople() {}

/// Flomble the florp
/// ```
/// t::florp();
/// ```
pub fn florp() {}
mkdir doctests
rustc +nightly --crate-type rlib t.rs
rustdoc +nightly -Zunstable-options --test --persist-doctests doctests --no-run --extern t=libt.rlib t.rs
ls -lR doctests/*/*

Without --no-run, this generates (and runs) executables:

-rwxrwxr-x. 1 jsgf jsgf 3385848 Aug 17 00:50 doctests/t_rs_2_0/rust_out
-rwxrwxr-x. 1 jsgf jsgf 3385840 Aug 17 00:50 doctests/t_rs_8_0/rust_out

I'd expect the same with --no-run.
Instead, with --no-run I get empty non-executable files:

-rw-rw-r--. 1 jsgf jsgf 0 Aug 17 00:51 doctests/t_rs_2_0/rust_out
-rw-rw-r--. 1 jsgf jsgf 0 Aug 17 00:51 doctests/t_rs_8_0/rust_out

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (2d2bc94c8 2021-08-15)
binary: rustc
commit-hash: 2d2bc94c8c3aa778e191f80261c726e4777439f1
commit-date: 2021-08-15
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: Documentation tests, run by rustdocC-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions