Skip to content

Commit

Permalink
Fix CI failure (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Mar 11, 2022
1 parent 8bf33a6 commit cb8a508
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 75 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
push:
branches:
- master
schedule:
- cron: '0 2 * * *'

env:
RUSTFLAGS: -Dwarnings
Expand All @@ -23,6 +25,7 @@ jobs:
- uses: actions/checkout@v1
- name: Install Rust
run: rustup update stable
- run: rustup component add rust-src
- run: cargo test --all-features

minrust:
Expand Down
8 changes: 4 additions & 4 deletions async-stream-impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ pub fn stream_inner(input: TokenStream) -> TokenStream {

let mut scrub = Scrub::new(false, &crate_path);

for mut stmt in &mut stmts {
scrub.visit_stmt_mut(&mut stmt);
for stmt in &mut stmts {
scrub.visit_stmt_mut(stmt);
}

let dummy_yield = if scrub.has_yielded {
Expand Down Expand Up @@ -246,8 +246,8 @@ pub fn try_stream_inner(input: TokenStream) -> TokenStream {

let mut scrub = Scrub::new(true, &crate_path);

for mut stmt in &mut stmts {
scrub.visit_stmt_mut(&mut stmt);
for stmt in &mut stmts {
scrub.visit_stmt_mut(stmt);
}

let dummy_yield = if scrub.has_yielded {
Expand Down
1 change: 1 addition & 0 deletions async-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ futures-core = "0.3"

[dev-dependencies]
futures-util = "0.3"
rustversion = "1"
tokio = { version = "1", features = ["full"] }
tokio-test = "0.4"
trybuild = "1"
5 changes: 3 additions & 2 deletions async-stream/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn noop_stream() {
let s = stream! {};
pin_mut!(s);

while let Some(_) = s.next().await {
while s.next().await.is_some() {
unreachable!();
}
}
Expand All @@ -28,7 +28,7 @@ async fn empty_stream() {
};
pin_mut!(s);

while let Some(_) = s.next().await {
while s.next().await.is_some() {
unreachable!();
}
}
Expand Down Expand Up @@ -229,6 +229,7 @@ fn inner_try_stream() {
};
}

#[rustversion::attr(not(stable), ignore)]
#[test]
fn test() {
let t = trybuild::TestCases::new();
Expand Down
2 changes: 1 addition & 1 deletion async-stream/tests/ui/yield_bad_expr_in_macro.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected expression
--> $DIR/yield_bad_expr_in_macro.rs:8:33
--> tests/ui/yield_bad_expr_in_macro.rs:8:33
|
8 | _ = work() => yield fn f() {},
| ^^
63 changes: 10 additions & 53 deletions async-stream/tests/ui/yield_in_async.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error[E0658]: yield syntax is experimental
--> $DIR/yield_in_async.rs:6:13
--> tests/ui/yield_in_async.rs:6:13
|
6 | yield 123;
| ^^^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information

error[E0727]: `async` generators are not yet supported
--> $DIR/yield_in_async.rs:6:13
--> tests/ui/yield_in_async.rs:6:13
|
6 | yield 123;
| ^^^^^^^^^

error[E0271]: type mismatch resolving `<[static generator@$DIR/src/lib.rs:201:9: 201:67] as Generator<ResumeTy>>::Yield == ()`
--> $DIR/yield_in_async.rs:4:5
--> tests/ui/yield_in_async.rs:4:5
|
4 | / stream! {
5 | | let f = async {
Expand All @@ -22,54 +22,11 @@ error[E0271]: type mismatch resolving `<[static generator@$DIR/src/lib.rs:201:9:
8 | |
9 | | let v = f.await;
10 | | };
| |______^ expected `()`, found integer
| |_____^ expected `()`, found integer
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0698]: type inside `async` block must be known in this context
--> $DIR/yield_in_async.rs:6:19
|
6 | yield 123;
| ^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `yield`
--> $DIR/yield_in_async.rs:6:13
|
6 | yield 123;
| ^^^^^^^^^

error[E0698]: type inside `async` block must be known in this context
--> $DIR/yield_in_async.rs:5:13
|
5 | let f = async {
| ^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> $DIR/yield_in_async.rs:9:17
|
9 | let v = f.await;
| ^^^^^^^

error[E0698]: type inside `async` block must be known in this context
--> $DIR/yield_in_async.rs:9:17
|
9 | let v = f.await;
| ^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> $DIR/yield_in_async.rs:9:17
|
9 | let v = f.await;
| ^^^^^^^

error[E0698]: type inside `async` block must be known in this context
--> $DIR/yield_in_async.rs:9:17
|
9 | let v = f.await;
| ^^^^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> $DIR/yield_in_async.rs:9:17
|
9 | let v = f.await;
| ^^^^^^^
note: required by a bound in `from_generator`
--> $RUST/core/src/future/mod.rs
|
| T: Generator<ResumeTy, Yield = ()>,
| ^^^^^^^^^^ required by this bound in `from_generator`
= note: this error originates in the macro `stream` (in Nightly builds, run with -Z macro-backtrace for more info)
22 changes: 12 additions & 10 deletions async-stream/tests/ui/yield_in_closure.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
error[E0658]: yield syntax is experimental
--> $DIR/yield_in_closure.rs:7:17
--> tests/ui/yield_in_closure.rs:7:17
|
7 | yield v;
| ^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information

error[E0277]: expected a `FnOnce<(&str,)>` closure, found `[generator@$DIR/src/lib.rs:201:9: 201:67]`
--> $DIR/yield_in_closure.rs:6:14
|
6 | .and_then(|v| {
| ^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `[generator@$DIR/src/lib.rs:201:9: 201:67]`
|
= help: the trait `FnOnce<(&str,)>` is not implemented for `[generator@$DIR/src/lib.rs:201:9: 201:67]`

Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
--> tests/ui/yield_in_closure.rs:6:14
|
6 | .and_then(|v| {
| ^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `[generator@$DIR/src/lib.rs:201:9: 201:67]`
|
= help: the trait `FnOnce<(&str,)>` is not implemented for `[generator@$DIR/src/lib.rs:201:9: 201:67]`
note: required by a bound in `Result::<T, E>::and_then`
--> $RUST/core/src/result.rs
|
| pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Result::<T, E>::and_then`
7 changes: 2 additions & 5 deletions async-stream/tests/ui/yield_in_nested_fn.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
error[E0658]: yield syntax is experimental
--> $DIR/yield_in_nested_fn.rs:6:13
--> tests/ui/yield_in_nested_fn.rs:6:13
|
6 | yield "hello";
| ^^^^^^^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information

error[E0627]: yield expression outside of generator literal
--> $DIR/yield_in_nested_fn.rs:6:13
--> tests/ui/yield_in_nested_fn.rs:6:13
|
6 | yield "hello";
| ^^^^^^^^^^^^^

Some errors have detailed explanations: E0627, E0658.
For more information about an error, try `rustc --explain E0627`.

0 comments on commit cb8a508

Please sign in to comment.