File tree Expand file tree Collapse file tree 2 files changed +565
-276
lines changed Expand file tree Collapse file tree 2 files changed +565
-276
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use pin_project_lite::pin_project;
22use std:: cell:: RefCell ;
33use std:: error:: Error ;
44use std:: future:: Future ;
5+ use std:: marker:: PhantomPinned ;
56use std:: pin:: Pin ;
67use std:: task:: { Context , Poll } ;
78use std:: { fmt, thread} ;
@@ -123,6 +124,7 @@ impl<T: 'static> LocalKey<T> {
123124 local : & self ,
124125 slot : Some ( value) ,
125126 future : f,
127+ _pinned : PhantomPinned ,
126128 }
127129 }
128130
@@ -147,12 +149,14 @@ impl<T: 'static> LocalKey<T> {
147149 where
148150 F : FnOnce ( ) -> R ,
149151 {
150- let mut scope = TaskLocalFuture {
152+ let scope = TaskLocalFuture {
151153 local : & self ,
152154 slot : Some ( value) ,
153155 future : ( ) ,
156+ _pinned : PhantomPinned ,
154157 } ;
155- Pin :: new ( & mut scope) . with_task ( |_| f ( ) )
158+ crate :: pin!( scope) ;
159+ scope. with_task ( |_| f ( ) )
156160 }
157161
158162 /// Accesses the current task-local and runs the provided closure.
@@ -234,6 +238,8 @@ pin_project! {
234238 slot: Option <T >,
235239 #[ pin]
236240 future: F ,
241+ #[ pin]
242+ _pinned: PhantomPinned ,
237243 }
238244}
239245
You can’t perform that action at this time.
0 commit comments