Display async fn in rustdoc.

This commit is contained in:
Without Boats
2018-05-17 14:47:52 -07:00
committed by Taylor Cramer
parent 18ff7d091a
commit 589446e19c
2 changed files with 18 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ use clean::{self, AttributesExt, GetDefId, SelfTy, Mutability};
use doctree;
use fold::DocFolder;
use html::escape::Escape;
use html::format::{ConstnessSpace};
use html::format::{AsyncSpace, ConstnessSpace};
use html::format::{GenericBounds, WhereClause, href, AbiSpace};
use html::format::{VisSpace, Method, UnsafetySpace, MutableSpace};
use html::format::fmt_impl_for_trait_page;
@@ -2574,9 +2574,10 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
f: &clean::Function) -> fmt::Result {
let name_len = format!("{}{}{}{:#}fn {}{:#}",
let name_len = format!("{}{}{}{}{:#}fn {}{:#}",
VisSpace(&it.visibility),
ConstnessSpace(f.header.constness),
AsyncSpace(f.header.asyncness),
UnsafetySpace(f.header.unsafety),
AbiSpace(f.header.abi),
it.name.as_ref().unwrap(),
@@ -2584,9 +2585,10 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
write!(w, "{}<pre class='rust fn'>", render_spotlight_traits(it)?)?;
render_attributes(w, it)?;
write!(w,
"{vis}{constness}{unsafety}{abi}fn {name}{generics}{decl}{where_clause}</pre>",
"{vis}{constness}{asyncness}{unsafety}{abi}fn {name}{generics}{decl}{where_clause}</pre>",
vis = VisSpace(&it.visibility),
constness = ConstnessSpace(f.header.constness),
asyncness = AsyncSpace(f.header.asyncness),
unsafety = UnsafetySpace(f.header.unsafety),
abi = AbiSpace(f.header.abi),
name = it.name.as_ref().unwrap(),