Skip to content

Commit 87ac3cb

Browse files
Merge branch 'rust-lang:master' into spawning
2 parents cc31e99 + 9c30051 commit 87ac3cb

File tree

7 files changed

+26
-13
lines changed

7 files changed

+26
-13
lines changed

examples/02_04_executor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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>`

examples/06_03_select/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ async fn get_new_num() -> u8 { /* ... */ 5 }
140140

141141
async 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.
150143
async fn run_loop(
151144
mut interval_timer: impl Stream<Item = ()> + FusedStream + Unpin,
152145
starting_num: u8,

examples/09_02_async_tcp_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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"
1111
features = ["attributes"]

examples/09_03_slow_request/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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"
1111
features = ["attributes"]

examples/09_04_concurrent_tcp_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ edition = "2021"
1010
futures = "0.3"
1111

1212
[dependencies.async-std]
13-
version = "1.6"
13+
version = "1.12"
1414
features = ["attributes"]

examples/09_05_final_tcp_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ edition = "2021"
1010
futures = "0.3"
1111

1212
[dependencies.async-std]
13-
version = "1.6"
13+
version = "1.12"
1414
features = ["attributes"]

src/04_pinning/01_chapter.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff 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`

0 commit comments

Comments
 (0)