Skip to content

Fix breakage on latest nightly. #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/bors.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
status = [
"test (nightly-2019-08-21)",
"test (nightly-2020-02-14)",
"test (nightly)",
"style (clippy)",
"style (rustfmt)",
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
# This is the minimum supported Rust version of this crate.
# When updating this, the reminder to update the minimum supported
# Rust version in README.md.
- nightly-2019-08-21
- nightly-2019-12-09
- nightly-2020-02-14
- nightly
steps:
- uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ futures-async-stream = "0.1"
futures = "0.3"
```

The current futures-async-stream requires Rust nightly 2019-08-21 or later.
The current futures-async-stream requires Rust nightly 2020-02-14 or later.

## \#\[for_await\]

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub mod future {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();
let _guard = unsafe { set_task_context(cx) };
match this.0.resume() {
match this.0.resume(()) {
GeneratorState::Yielded(()) => Poll::Pending,
GeneratorState::Complete(x) => Poll::Ready(x),
}
Expand Down Expand Up @@ -376,7 +376,7 @@ pub mod stream {
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let this = self.project();
let _guard = unsafe { set_task_context(cx) };
match this.gen.resume() {
match this.gen.resume(()) {
GeneratorState::Yielded(x) => x.map(Some),
GeneratorState::Complete(()) => Poll::Ready(None),
}
Expand Down Expand Up @@ -492,7 +492,7 @@ pub mod try_stream {

let this = self.project();
let _guard = unsafe { set_task_context(cx) };
let res = match this.gen.resume() {
let res = match this.gen.resume(()) {
GeneratorState::Yielded(x) => x.map(|x| Some(Ok(x))),
GeneratorState::Complete(Err(e)) => Poll::Ready(Some(Err(e))),
GeneratorState::Complete(Ok(())) => Poll::Ready(None),
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/bad-item-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ note: the type is part of the generator because of this `yield`
|
5 | #[async_stream(item = Option<i32>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:12:9
Expand All @@ -33,6 +34,7 @@ note: the type is part of the generator because of this `yield`
|
5 | #[async_stream(item = Option<i32>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:13:11
Expand All @@ -45,6 +47,7 @@ note: the type is part of the generator because of this `yield`
|
5 | #[async_stream(item = Option<i32>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
--> $DIR/bad-item-type.rs:21:11
Expand Down Expand Up @@ -76,6 +79,7 @@ note: the type is part of the generator because of this `yield`
|
16 | #[async_stream(item = (i32, i32))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:16:1
Expand All @@ -88,6 +92,7 @@ note: the type is part of the generator because of this `yield`
|
16 | #[async_stream(item = (i32, i32))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:21:12
Expand All @@ -100,6 +105,7 @@ note: the type is part of the generator because of this `yield`
|
16 | #[async_stream(item = (i32, i32))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:21:15
Expand All @@ -112,6 +118,7 @@ note: the type is part of the generator because of this `yield`
|
16 | #[async_stream(item = (i32, i32))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside generator must be known in this context
--> $DIR/bad-item-type.rs:21:11
Expand All @@ -124,3 +131,4 @@ note: the type is part of the generator because of this `yield`
|
16 | #[async_stream(item = (i32, i32))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
2 changes: 2 additions & 0 deletions tests/ui/missing-item.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ error: unexpected end of input, expected `item`
|
5 | #[async_stream] //~ ERROR unexpected end of input, expected `item`
| ^^^^^^^^^^^^^^^
|
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
7 changes: 3 additions & 4 deletions tests/ui/move-captured-variable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ error[E0507]: cannot move out of `a`, a captured variable in an `FnMut` closure
| | move occurs because `a` has type `std::string::String`, which does not implement the `Copy` trait
| | move occurs due to use in generator
12 | | };
| | ^
| | |
| |__________move out of `a` occurs here
| in this macro invocation
| |__________^ move out of `a` occurs here
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1 change: 1 addition & 0 deletions tests/ui/unresolved-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ note: the type is part of the generator because of this `yield`
|
5 | #[async_stream(item = Left)] //~ ERROR cannot find type `Left` in this scope
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)