Skip to content

Inconsistent syntax between unsafe async fn and async fn unsafe #62232

Closed
@topecongiro

Description

@topecongiro

There is an inconsistency in the ordering of async and unsafe keywords that come before the fn signature. A plain function signature requires async unsafe fn, whereas a method signature requires unsafe async fn:

#![feature(async_await)]

struct A;

pub async unsafe fn thing() -> Result<(), ()> {
    unimplemented!()
}

impl A {
    pub unsafe async fn thing(&mut self) -> Result<(), ()> {
        unimplemented!()
    }
}

fn main() {}

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-grammarArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an ASTAsyncAwait-PolishAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.T-compilerRelevant to the compiler 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