-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Description
URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/book/ch17-03-more-futures.html
Description of the problem:
The 2-line code excerpt in Listing 17-18 shown on the page linked above fails to compile when integrated into the source snippets derived from earlier example listings.
This is because a "use" statement for "Pin" is missing (see compiler output below).
Note the full code where the 2 lines are an excerpt of contains another use statement also dealing with "Pin" but that code is of course not visible to the reader of this book page. There is no mentioning of "Pin" in earlier parts of chapter 17.
$ cargo build
Compiling async_channel_4 v0.1.0 (/home/ostkamp/rust/projects/17_Fundamentals_of_Async_Programming/async_channels_4)
error[E0412]: cannot find type `Pin` in this scope
--> src/main.rs:59:26
|
59 | let futures: Vec<Pin<Box<dyn Future<Output = ()>>>> = vec![Box::pin(tx1_fut), Box::pin(rx_fut), Box::pin(tx_fut)];
| ^^^ not found in this scope
|
help: consider importing this struct
|
4 + use std::pin::Pin;
|
For more information about this error, try `rustc --explain E0412`.
error: could not compile `async_channel_4` (bin "async_channel_4") due to 1 previous error
Suggested fix:
Please include a hint that the "use" statement has to be added to build this.
Metadata
Metadata
Assignees
Labels
No labels