Closed
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 fn
toasync unsafe fn
#61319. - A link to the playground
- An original issue in rustfmt: unsafe async fn -> async unsafe fn + error rustfmt#3662