Skip to content

async move breaks doc tests #59313

Closed
@ghost

Description

Steps to reproduce:

  1. Create a library project with the following contents in lib.rs:
//! ```
//! #![feature(async_await)]
//!
//! fn foo() {
//!     drop(async move {});
//! }
//! ```
  1. Run tests:
repro master $ cargo --version
cargo 1.35.0-nightly (0e35bd8af 2019-03-13)
repro master $ rustc --version
rustc 1.35.0-nightly (3eb4890df 2019-03-19)
repro master $ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running target/debug/deps/repro-0e401502cf52c662

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests repro

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

failures:

failures:
    src/lib.rs -  (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--doc'
  1. Now delete the move inside async move {}:
//! ```
//! #![feature(async_await)]
//!
//! fn foo() {
//!     drop(async {});
//! }
//! ```
  1. Run tests again:
repro master $ cargo test
   Compiling repro v0.1.0 (/home/stjepan/work/repro)
    Finished dev [unoptimized + debuginfo] target(s) in 0.25s
     Running target/debug/deps/repro-0e401502cf52c662

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests repro

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

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-doctestsArea: Documentation tests, run by rustdocAsyncAwait-PolishAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.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