@@ -556,9 +556,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
556
556
/// ```rust
557
557
/// match <expr> {
558
558
/// mut pinned => loop {
559
- /// match unsafe { ::std::future::poll_with_context (
559
+ /// match unsafe { ::std::future::Future::poll (
560
560
/// <::std::pin::Pin>::new_unchecked(&mut pinned),
561
- /// task_context,
561
+ /// ::std::future::get_context( task_context) ,
562
562
/// ) } {
563
563
/// ::std::task::Poll::Ready(result) => break result,
564
564
/// ::std::task::Poll::Pending => {}
@@ -598,9 +598,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
598
598
let task_context_ident = Ident :: with_dummy_span ( sym:: _task_context) ;
599
599
600
600
// unsafe {
601
- // ::std::future::poll_with_context (
601
+ // ::std::future::Future::poll (
602
602
// ::std::pin::Pin::new_unchecked(&mut pinned),
603
- // task_context,
603
+ // ::std::future::get_context( task_context) ,
604
604
// )
605
605
// }
606
606
let poll_expr = {
@@ -621,10 +621,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
621
621
arena_vec ! [ self ; ref_mut_pinned] ,
622
622
) ;
623
623
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 (
625
625
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] ,
628
633
) ;
629
634
self . arena . alloc ( self . expr_unsafe ( call) )
630
635
} ;
@@ -1326,25 +1331,43 @@ impl<'hir> LoweringContext<'_, 'hir> {
1326
1331
self . arena . alloc ( self . expr ( sp, hir:: ExprKind :: Tup ( & [ ] ) , ThinVec :: new ( ) ) )
1327
1332
}
1328
1333
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
+
1329
1343
fn expr_call (
1330
1344
& mut self ,
1331
1345
span : Span ,
1332
1346
e : & ' hir hir:: Expr < ' hir > ,
1333
1347
args : & ' hir [ hir:: Expr < ' hir > ] ,
1334
1348
) -> & ' 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) )
1336
1350
}
1337
1351
1338
1352
// Note: associated functions must use `expr_call_std_path`.
1339
- fn expr_call_std_path (
1353
+ fn expr_call_std_path_mut (
1340
1354
& mut self ,
1341
1355
span : Span ,
1342
1356
path_components : & [ Symbol ] ,
1343
1357
args : & ' hir [ hir:: Expr < ' hir > ] ,
1344
- ) -> & ' hir hir:: Expr < ' hir > {
1358
+ ) -> hir:: Expr < ' hir > {
1345
1359
let path =
1346
1360
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) )
1348
1371
}
1349
1372
1350
1373
// Create an expression calling an associated function of an std type.
0 commit comments