Closed
Description
Rustdoc seems to fail on async syntax in some situations.
With edition = "2018"
in Cargo.toml, the following is a sample of some apparent issues.
#![feature(rust_2018_preview, async_await, futures_api)]
#![allow(unused)]
use std::future::Future;
struct S;
impl S {
async fn f() {}
}
fn f() {
async move { };
}
fn async_closure(x: u8) -> impl Future<Output = u8> {
(async move |x: u8| -> u8 {
x
})(x)
}
This should build fine, but fails when running rustdoc:
cargo +376b60da8b65d7c4392f0a5e2b45c42e84bd01ce doc
Documenting ed v0.1.0 (file:///Users/eric/Proj/rust/cargo/scratch/ed)
error: missing `fn`, `type`, or `const` for impl-item declaration
--> src/lib.rs:8:9
|
8 | impl S {
| _________^
9 | | async fn f() {}
| |____^ missing `fn`, `type`, or `const`
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `move`
--> src/lib.rs:13:11
|
13 | async move { };
| ^^^^ expected one of 8 possible tokens here
error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `move`
--> src/lib.rs:17:12
|
17 | (async move |x: u8| -> u8 {
| ^^^^ expected one of 8 possible tokens here
error[E0277]: the trait bound `(): std::future::Future` is not satisfied
--> src/lib.rs:16:28
|
16 | fn async_closure(x: u8) -> impl Future<Output = u8> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `()`
|
= note: the return type of a function must have a statically known size
error: Compilation failed, aborting rustdoc
error: Could not document `ed`.
Caused by:
process didn't exit successfully: `rustdoc -Zunstable-options --edition=2018 --crate-name ed src/lib.rs -o /Users/eric/Proj/rust/cargo/scratch/ed/target/doc -L dependency=/Users/eric/Proj/rust/cargo/scratch/ed/target/debug/deps` (exit code: 1)
Tested with a few different nightlies (rustc 1.30.0-nightly (73c7873 2018-08-05)) and latest master (376b60d).