Skip to content

cannot build on latest nightly: get_task_context not found #30

@gauteh

Description

@gauteh

Hi, I am trying to use this in combination with hyper. But first just trying to build this repository alone. I ran rustup update, and I have:

❯ rustup show
Default host: x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain
----------------

nightly-x86_64-apple-darwin (default)
rustc 1.41.0-nightly (0c987c5c0 2019-11-23)

when I try to cargo build this crate, I get:


   Compiling futures-async-stream v0.1.1 (/Users/gauteh/dev/futures-async-stream)
error[E0425]: cannot find function `get_task_context` in module `future`
  --> src/stream.rs:59:13
   |
59 |     future::get_task_context(|cx| S::poll_next(s, cx))
   |             ^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `set_task_context`

error[E0425]: cannot find function `get_task_context` in module `future`
  --> src/stream.rs:71:13
   |
71 |     future::get_task_context(|cx| F::poll(f, cx))
   |             ^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `set_task_context`

error[E0603]: function `set_task_context` is private
  --> src/stream.rs:43:17
   |
43 |         future::set_task_context(cx, || match this.gen.resume() {
   |                 ^^^^^^^^^^^^^^^^

error[E0603]: function `set_task_context` is private
  --> src/try_stream.rs:49:27
   |
49 |         let res = future::set_task_context(cx, || match this.gen.as_mut().resume() {
   |                           ^^^^^^^^^^^^^^^^

error[E0061]: this function takes 1 parameter but 2 parameters were supplied
  --> src/stream.rs:43:9
   |
43 | /         future::set_task_context(cx, || match this.gen.resume() {
44 | |             GeneratorState::Yielded(x) => x.map(Some),
45 | |             GeneratorState::Complete(()) => Poll::Ready(None),
46 | |         })
   | |__________^ expected 1 parameter

error[E0308]: mismatched types
  --> src/stream.rs:43:9
   |
41 |       fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
   |                                                                   ------------------------ expected `std::task::Poll<std::option::Option<T>>` because of return type
42 |           let this = self.project();
43 | /         future::set_task_context(cx, || match this.gen.resume() {
44 | |             GeneratorState::Yielded(x) => x.map(Some),
45 | |             GeneratorState::Complete(()) => Poll::Ready(None),
46 | |         })
   | |__________^ expected enum `std::task::Poll`, found struct `std::future::SetOnDrop`
   |
   = note: expected enum `std::task::Poll<std::option::Option<T>>`
            found struct `std::future::SetOnDrop`

error[E0061]: this function takes 1 parameter but 2 parameters were supplied
  --> src/try_stream.rs:49:19
   |
49 |           let res = future::set_task_context(cx, || match this.gen.as_mut().resume() {
   |  ___________________^
50 | |             GeneratorState::Yielded(x) => x.map(|x| Some(Ok(x))),
51 | |             GeneratorState::Complete(Err(e)) => Poll::Ready(Some(Err(e))),
52 | |             GeneratorState::Complete(Ok(())) => Poll::Ready(None),
53 | |         });
   | |__________^ expected 1 parameter

error[E0308]: mismatched types
  --> src/try_stream.rs:54:16
   |
54 |         if let Poll::Ready(Some(Err(_))) | Poll::Ready(None) = &res {
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^                       ---- this match expression has type `std::future::SetOnDrop`
   |                |
   |                expected struct `std::future::SetOnDrop`, found enum `std::task::Poll`
   |
   = note: expected struct `std::future::SetOnDrop`
                found enum `std::task::Poll<_>`

error[E0308]: mismatched types
  --> src/try_stream.rs:54:44
   |
54 |         if let Poll::Ready(Some(Err(_))) | Poll::Ready(None) = &res {
   |                                            ^^^^^^^^^^^^^^^^^   ---- this match expression has type `std::future::SetOnDrop`
   |                                            |
   |                                            expected struct `std::future::SetOnDrop`, found enum `std::task::Poll`
   |
   = note: expected struct `std::future::SetOnDrop`
                found enum `std::task::Poll<_>`

error[E0308]: mismatched types
  --> src/try_stream.rs:57:9
   |
43 |     fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
   |                                                                 ------------------------ expected `std::task::Poll<std::option::Option<std::result::Result<T, E>>>` because of return type
...
57 |         res
   |         ^^^ expected enum `std::task::Poll`, found struct `std::future::SetOnDrop`
   |
   = note: expected enum `std::task::Poll<std::option::Option<std::result::Result<T, E>>>`
            found struct `std::future::SetOnDrop`

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0061, E0308, E0425, E0603.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `futures-async-stream`.

```

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: related to a bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions