File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -6744,13 +6744,19 @@ impl<'a> Parser<'a> {
67446744 maybe_append ( attrs, extra_attrs) ) ;
67456745 return Ok ( Some ( item) ) ;
67466746 }
6747- if self . check_keyword ( keywords:: Async ) &&
6748- ( self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Fn ) ) ||
6749- self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Unsafe ) ) )
6747+
6748+ // `unsafe async fn` or `async fn`
6749+ if (
6750+ self . check_keyword ( keywords:: Unsafe ) &&
6751+ self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Async ) )
6752+ ) || (
6753+ self . check_keyword ( keywords:: Async ) &&
6754+ self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Fn ) )
6755+ )
67506756 {
67516757 // ASYNC FUNCTION ITEM
6752- self . expect_keyword ( keywords:: Async ) ?;
67536758 let unsafety = self . parse_unsafety ( ) ;
6759+ self . expect_keyword ( keywords:: Async ) ?;
67546760 self . expect_keyword ( keywords:: Fn ) ?;
67556761 let fn_span = self . prev_span ;
67566762 let ( ident, item_, extra_attrs) =
Original file line number Diff line number Diff line change @@ -99,6 +99,19 @@ fn async_fn_with_internal_borrow(y: u8) -> impl Future<Output = u8> {
9999 }
100100}
101101
102+ unsafe async fn unsafe_async_fn ( x : u8 ) -> u8 {
103+ await ! ( wake_and_yield_once( ) ) ;
104+ x
105+ }
106+
107+ struct Foo {
108+ async fn async_method( x : u8 ) -> u8 {
109+ unsafe {
110+ await ! ( unsafe_async_fn( ) )
111+ }
112+ }
113+ }
114+
102115fn test_future_yields_once_then_returns < F , Fut > ( f : F )
103116where
104117 F : FnOnce ( u8 ) -> Fut ,
You can’t perform that action at this time.
0 commit comments