- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-grammarArea: The grammar of RustArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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() {}- A related PR: Swap order of unsafe async fntoasync unsafe fn#61319.
- A link to the playground
- An original issue in rustfmt: unsafe async fn -> async unsafe fn + error rustfmt#3662
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-grammarArea: The grammar of RustArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.