@@ -556,9 +556,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
556556 /// ```rust
557557 /// match <expr> {
558558 /// mut pinned => loop {
559- /// match unsafe { ::std::future::poll_with_context (
559+ /// match unsafe { ::std::future::Future::poll (
560560 /// <::std::pin::Pin>::new_unchecked(&mut pinned),
561- /// task_context,
561+ /// ::std::future::get_context( task_context) ,
562562 /// ) } {
563563 /// ::std::task::Poll::Ready(result) => break result,
564564 /// ::std::task::Poll::Pending => {}
@@ -598,9 +598,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
598598 let task_context_ident = Ident :: with_dummy_span ( sym:: _task_context) ;
599599
600600 // unsafe {
601- // ::std::future::poll_with_context (
601+ // ::std::future::Future::poll (
602602 // ::std::pin::Pin::new_unchecked(&mut pinned),
603- // task_context,
603+ // ::std::future::get_context( task_context) ,
604604 // )
605605 // }
606606 let poll_expr = {
@@ -621,10 +621,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
621621 arena_vec ! [ self ; ref_mut_pinned] ,
622622 ) ;
623623 let new_unchecked = self . expr ( span, new_unchecked_expr_kind, ThinVec :: new ( ) ) ;
624- let call = self . expr_call_std_path (
624+ let get_context = self . expr_call_std_path_mut (
625625 gen_future_span,
626- & [ sym:: future, sym:: poll_with_context] ,
627- arena_vec ! [ self ; new_unchecked, task_context] ,
626+ & [ sym:: future, sym:: get_context] ,
627+ arena_vec ! [ self ; task_context] ,
628+ ) ;
629+ let call = self . expr_call_std_path (
630+ span,
631+ & [ sym:: future, sym:: Future , sym:: poll] ,
632+ arena_vec ! [ self ; new_unchecked, get_context] ,
628633 ) ;
629634 self . arena . alloc ( self . expr_unsafe ( call) )
630635 } ;
@@ -1326,25 +1331,43 @@ impl<'hir> LoweringContext<'_, 'hir> {
13261331 self . arena . alloc ( self . expr ( sp, hir:: ExprKind :: Tup ( & [ ] ) , ThinVec :: new ( ) ) )
13271332 }
13281333
1334+ fn expr_call_mut (
1335+ & mut self ,
1336+ span : Span ,
1337+ e : & ' hir hir:: Expr < ' hir > ,
1338+ args : & ' hir [ hir:: Expr < ' hir > ] ,
1339+ ) -> hir:: Expr < ' hir > {
1340+ self . expr ( span, hir:: ExprKind :: Call ( e, args) , ThinVec :: new ( ) )
1341+ }
1342+
13291343 fn expr_call (
13301344 & mut self ,
13311345 span : Span ,
13321346 e : & ' hir hir:: Expr < ' hir > ,
13331347 args : & ' hir [ hir:: Expr < ' hir > ] ,
13341348 ) -> & ' hir hir:: Expr < ' hir > {
1335- self . arena . alloc ( self . expr ( span, hir :: ExprKind :: Call ( e, args) , ThinVec :: new ( ) ) )
1349+ self . arena . alloc ( self . expr_call_mut ( span, e, args) )
13361350 }
13371351
13381352 // Note: associated functions must use `expr_call_std_path`.
1339- fn expr_call_std_path (
1353+ fn expr_call_std_path_mut (
13401354 & mut self ,
13411355 span : Span ,
13421356 path_components : & [ Symbol ] ,
13431357 args : & ' hir [ hir:: Expr < ' hir > ] ,
1344- ) -> & ' hir hir:: Expr < ' hir > {
1358+ ) -> hir:: Expr < ' hir > {
13451359 let path =
13461360 self . arena . alloc ( self . expr_std_path ( span, path_components, None , ThinVec :: new ( ) ) ) ;
1347- self . expr_call ( span, path, args)
1361+ self . expr_call_mut ( span, path, args)
1362+ }
1363+
1364+ fn expr_call_std_path (
1365+ & mut self ,
1366+ span : Span ,
1367+ path_components : & [ Symbol ] ,
1368+ args : & ' hir [ hir:: Expr < ' hir > ] ,
1369+ ) -> & ' hir hir:: Expr < ' hir > {
1370+ self . arena . alloc ( self . expr_call_std_path_mut ( span, path_components, args) )
13481371 }
13491372
13501373 // Create an expression calling an associated function of an std type.
0 commit comments