Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Correct order of async and unsafe in async unsafe fns #68397

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2321,8 +2321,8 @@ fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Func
"{}{}{}{}{:#}fn {}{:#}",
it.visibility.print_with_space(),
f.header.constness.print_with_space(),
f.header.unsafety.print_with_space(),
f.header.asyncness.print_with_space(),
f.header.unsafety.print_with_space(),
print_abi_with_space(f.header.abi),
it.name.as_ref().unwrap(),
f.generics.print()
Expand All @@ -2332,12 +2332,12 @@ fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Func
render_attributes(w, it, false);
write!(
w,
"{vis}{constness}{unsafety}{asyncness}{abi}fn \
"{vis}{constness}{asyncness}{unsafety}{abi}fn \
{name}{generics}{decl}{where_clause}</pre>",
vis = it.visibility.print_with_space(),
constness = f.header.constness.print_with_space(),
unsafety = f.header.unsafety.print_with_space(),
asyncness = f.header.asyncness.print_with_space(),
unsafety = f.header.unsafety.print_with_space(),
abi = print_abi_with_space(f.header.abi),
name = it.name.as_ref().unwrap(),
generics = f.generics.print(),
Expand Down Expand Up @@ -2832,8 +2832,8 @@ fn render_assoc_item(
"{}{}{}{}{}{:#}fn {}{:#}",
meth.visibility.print_with_space(),
header.constness.print_with_space(),
header.unsafety.print_with_space(),
header.asyncness.print_with_space(),
header.unsafety.print_with_space(),
print_default_space(meth.is_default()),
print_abi_with_space(header.abi),
name,
Expand All @@ -2854,8 +2854,8 @@ fn render_assoc_item(
if parent == ItemType::Trait { " " } else { "" },
meth.visibility.print_with_space(),
header.constness.print_with_space(),
header.unsafety.print_with_space(),
header.asyncness.print_with_space(),
header.unsafety.print_with_space(),
print_default_space(meth.is_default()),
print_abi_with_space(header.abi),
href = href,
Expand Down
7 changes: 7 additions & 0 deletions src/test/rustdoc/async-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ pub async fn baz<T>(a: T) -> T {
a
}

// @has async_fn/fn.qux.html '//pre[@class="rust fn"]' 'pub async unsafe fn qux() -> char'
pub async unsafe fn qux() -> char {
'⚠'
}

trait Bar {}

impl Bar for () {}
Expand All @@ -26,8 +31,10 @@ pub async fn quux() -> impl Bar {

// @has async_fn/struct.Foo.html
// @matches - '//code' 'pub async fn f\(\)$'
// @matches - '//code' 'pub async unsafe fn g\(\)$'
pub struct Foo;

impl Foo {
pub async fn f() {}
pub async unsafe fn g() {}
}