File tree Expand file tree Collapse file tree 7 files changed +26
-13
lines changed
09_04_concurrent_tcp_server Expand file tree Collapse file tree 7 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl Executor {
9090 if let Some ( mut future) = future_slot. take ( ) {
9191 // Create a `LocalWaker` from the task itself
9292 let waker = waker_ref ( & task) ;
93- let context = & mut Context :: from_waker ( & * waker) ;
93+ let context = & mut Context :: from_waker ( & waker) ;
9494 // `BoxFuture<T>` is a type alias for
9595 // `Pin<Box<dyn Future<Output = T> + Send + 'static>>`.
9696 // We can get a `Pin<&mut dyn Future + Send + 'static>`
Original file line number Diff line number Diff line change @@ -140,13 +140,6 @@ async fn get_new_num() -> u8 { /* ... */ 5 }
140140
141141async fn run_on_new_num ( _: u8 ) -> u8 { /* ... */ 5 }
142142
143- // Runs `run_on_new_num` with the latest number
144- // retrieved from `get_new_num`.
145- //
146- // `get_new_num` is re-run every time a timer elapses,
147- // immediately cancelling the currently running
148- // `run_on_new_num` and replacing it with the newly
149- // returned value.
150143async fn run_loop (
151144 mut interval_timer : impl Stream < Item = ( ) > + FusedStream + Unpin ,
152145 starting_num : u8 ,
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ edition = "2021"
77# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88
99[dependencies .async-std ]
10- version = " 1.6 "
10+ version = " 1.12 "
1111features = [" attributes" ]
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ edition = "2021"
77# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88
99[dependencies .async-std ]
10- version = " 1.6 "
10+ version = " 1.12 "
1111features = [" attributes" ]
Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ edition = "2021"
1010futures = " 0.3"
1111
1212[dependencies .async-std ]
13- version = " 1.6 "
13+ version = " 1.12 "
1414features = [" attributes" ]
Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ edition = "2021"
1010futures = " 0.3"
1111
1212[dependencies .async-std ]
13- version = " 1.6 "
13+ version = " 1.12 "
1414features = [" attributes" ]
Original file line number Diff line number Diff line change @@ -480,7 +480,27 @@ pub fn main() {
480480# }
481481```
482482
483- The type system prevents us from moving the data.
483+ The type system prevents us from moving the data, as follows:
484+
485+ ```
486+ error[E0277]: `PhantomPinned` cannot be unpinned
487+ --> src\test.rs:56:30
488+ |
489+ 56 | std::mem::swap(test1.get_mut(), test2.get_mut());
490+ | ^^^^^^^ within `test1::Test`, the trait `Unpin` is not implemented for `PhantomPinned`
491+ |
492+ = note: consider using `Box::pin`
493+ note: required because it appears within the type `test1::Test`
494+ --> src\test.rs:7:8
495+ |
496+ 7 | struct Test {
497+ | ^^^^
498+ note: required by a bound in `std::pin::Pin::<&'a mut T>::get_mut`
499+ --> <...>rustlib/src/rust\library\core\src\pin.rs:748:12
500+ |
501+ 748 | T: Unpin,
502+ | ^^^^^ required by this bound in `std::pin::Pin::<&'a mut T>::get_mut`
503+ ```
484504
485505> It's important to note that stack pinning will always rely on guarantees
486506> you give when writing ` unsafe ` . While we know that the _ pointee_ of ` &'a mut T `
You can’t perform that action at this time.
0 commit comments