From bc0a343a84330ba1b1ae52d9267d1e2133a5c087 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 23 Sep 2020 13:01:15 -0700 Subject: [PATCH 1/2] Stop using proc-macro-hack --- .github/workflows/ci.yml | 6 +- .pre-commit-config.yaml | 2 +- Cargo.lock | 288 ++++++++---------- Cargo.toml | 6 +- examples/basic/Cargo.lock | 95 +++--- genawaiter-proc-macro/Cargo.toml | 1 - genawaiter-proc-macro/src/lib.rs | 9 +- src/lib.rs | 8 +- src/rc/stream.rs | 3 +- src/stack/nightly_tests.rs | 2 +- src/stack/stream.rs | 3 +- src/sync/mod.rs | 2 +- src/sync/stream.rs | 3 +- tests/rc.rs | 2 +- tests/stack.rs | 2 +- tests/sync.rs | 2 +- tests/ui/stack_fail_not_awaiting_yield.rs | 4 +- tests/ui/stack_fail_not_awaiting_yield.stderr | 12 +- tests/ui/stack_fail_when_co_is_static.stderr | 2 +- 19 files changed, 193 insertions(+), 259 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3a9bd8..58b4c67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2019-11-06 + toolchain: nightly-2020-06-25 profile: minimal components: rustfmt override: true @@ -26,7 +26,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.39.0 + toolchain: 1.46.0 profile: minimal components: clippy override: true @@ -39,7 +39,7 @@ jobs: test: strategy: matrix: - toolchain: [1.39.0, nightly-2019-11-06] + toolchain: [1.46.0, nightly-2020-06-25] features: - '' - --features futures03 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6c92ea..22c2a37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: name: fmt language: system files: '[.]rs$' - entry: rustup run nightly-2019-11-06 rustfmt + entry: rustup run nightly-2020-06-25 rustfmt - id: check name: check diff --git a/Cargo.lock b/Cargo.lock index c424dc4..4fd2f29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,84 +1,37 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "futures" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures-channel" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "futures-core" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures-executor" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "futures-io" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures-macro" -version = "0.3.1" +name = "futures-task" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "futures-sink" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures-task" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "futures-util" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -86,14 +39,14 @@ dependencies = [ name = "genawaiter" version = "0.99.1" dependencies = [ - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "genawaiter-macro 0.99.1", "genawaiter-proc-macro 0.99.1", - "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "trybuild 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "trybuild 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -104,11 +57,10 @@ version = "0.99.1" name = "genawaiter-proc-macro" version = "0.99.1" dependencies = [ - "proc-macro-error 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -118,7 +70,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -126,117 +78,115 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "memchr" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "once_cell" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "pin-utils" -version = "0.1.0-alpha.4" +name = "pin-project" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pin-project-internal 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] -name = "proc-macro-error" -version = "0.4.4" +name = "pin-project-internal" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-error-attr 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "proc-macro-error-attr" -version = "0.4.3" +name = "pin-utils" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn-mid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "proc-macro-hack" -version = "0.5.11" +name = "proc-macro-error" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error-attr 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "proc-macro-nested" -version = "0.1.3" +name = "proc-macro-error-attr" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "proc-macro2" -version = "1.0.6" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustversion" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.104" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.104" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.48" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -246,22 +196,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.8" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn-mid" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -269,7 +219,7 @@ name = "termcolor" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -277,30 +227,35 @@ name = "toml" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trybuild" -version = "1.0.23" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -314,10 +269,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -326,40 +281,35 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" -"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" -"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" -"checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" -"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" -"checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" -"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" -"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" -"checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" +"checksum futures-core 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" +"checksum futures-executor 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +"checksum futures-task 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +"checksum futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +"checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" -"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" -"checksum proc-macro-error 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "53c98547ceaea14eeb26fcadf51dc70d01a2479a7839170eae133721105e4428" -"checksum proc-macro-error-attr 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c2bf5d493cf5d3e296beccfd61794e445e830dfc8070a9c248ad3ee071392c6c" -"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6" -"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" -"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" -"checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" +"checksum once_cell 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +"checksum pin-project 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)" = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" +"checksum pin-project-internal 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)" = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" +"checksum pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +"checksum proc-macro-error 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +"checksum proc-macro-error-attr 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +"checksum proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" +"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +"checksum rustversion 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b9bdc5e856e51e685846fb6c13a1f5e5432946c2c90501bdc76a1319f19e29da" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" +"checksum serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +"checksum serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)" = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -"checksum syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92" -"checksum syn-mid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd3937748a7eccff61ba5b90af1a20dbf610858923a9192ea0ecb0cb77db1d0" +"checksum syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b" +"checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -"checksum trybuild 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "26ff1b18659a2218332848d76ad1c867ce4c6ee37b085e6bc8de9a6d11401220" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum trybuild 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d30fe369fd650072b352b1a9cb9587669de6b89be3b8225544012c1c45292d" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index bc824c9..144c7ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,13 @@ include = ["Cargo.toml", "README-crates-io.md", "src/**/*.rs"] futures-core = { version = "0.3.1", optional = true } genawaiter-proc-macro = { version = "0.99.1", path = "./genawaiter-proc-macro", optional = true } genawaiter-macro = { version = "0.99.1", path = "./genawaiter-macro" } -proc-macro-hack = { version = "0.5", optional = true } [workspace] members = ["genawaiter-macro", "genawaiter-proc-macro"] [dev-dependencies] -futures = "0.3.1" +futures-executor = "0.3.1" +futures-util = { version = "0.3.1", default-features = false } once_cell = "1.3.1" rustversion = "1.0.2" trybuild = "1" @@ -34,4 +34,4 @@ default = ["proc_macro"] futures03 = ["futures-core"] nightly = [] strict = [] -proc_macro = ["genawaiter-proc-macro", "proc-macro-hack", "genawaiter-macro/proc_macro"] +proc_macro = ["genawaiter-proc-macro", "genawaiter-macro/proc_macro"] diff --git a/examples/basic/Cargo.lock b/examples/basic/Cargo.lock index 82fb41c..9f13450 100644 --- a/examples/basic/Cargo.lock +++ b/examples/basic/Cargo.lock @@ -2,93 +2,81 @@ # It is not intended for manual editing. [[package]] name = "genawaiter" -version = "0.99.0" +version = "0.99.1" dependencies = [ - "genawaiter-macro 0.99.0", - "genawaiter-proc-macro 0.99.0", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "genawaiter-macro 0.99.1", + "genawaiter-proc-macro 0.99.1", ] [[package]] name = "genawaiter-example-basic" version = "0.0.0" dependencies = [ - "genawaiter 0.99.0", + "genawaiter 0.99.1", ] [[package]] name = "genawaiter-macro" -version = "0.99.0" +version = "0.99.1" [[package]] name = "genawaiter-proc-macro" -version = "0.99.0" +version = "0.99.1" dependencies = [ - "proc-macro-error 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro-error" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-error-attr 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error-attr 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro-error-attr" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro2" -version = "1.0.9" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" -version = "1.0.3" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "1.0.16" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -96,28 +84,27 @@ name = "syn-mid" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum proc-macro-error 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e7959c6467d962050d639361f7703b2051c43036d03493c36f01d440fdd3138a" -"checksum proc-macro-error-attr 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e4002d9f55991d5e019fb940a90e1a95eb80c24e77cb2462dd4dc869604d543a" -"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" -"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" -"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" -"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" +"checksum proc-macro-error 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +"checksum proc-macro-error-attr 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +"checksum proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" +"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +"checksum syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" diff --git a/genawaiter-proc-macro/Cargo.toml b/genawaiter-proc-macro/Cargo.toml index d6263e8..cf6c8f2 100644 --- a/genawaiter-proc-macro/Cargo.toml +++ b/genawaiter-proc-macro/Cargo.toml @@ -18,7 +18,6 @@ quote = "1.0" proc-macro2 = "1.0" syn = { version = "1.0", features = ["visit-mut", "full"] } proc-macro-error = "0.4" -proc-macro-hack = "0.5" [features] strict = [] diff --git a/genawaiter-proc-macro/src/lib.rs b/genawaiter-proc-macro/src/lib.rs index 6d6b37c..454cfbf 100644 --- a/genawaiter-proc-macro/src/lib.rs +++ b/genawaiter-proc-macro/src/lib.rs @@ -2,12 +2,9 @@ #![warn(clippy::cargo, clippy::pedantic)] #![cfg_attr(feature = "strict", deny(warnings))] -extern crate proc_macro; - use crate::visit::YieldReplace; use proc_macro::TokenStream; use proc_macro_error::{abort, abort_call_site, proc_macro_error}; -use proc_macro_hack::proc_macro_hack; use quote::quote; use std::string::ToString; use syn::{ @@ -42,7 +39,7 @@ pub fn stack_producer_fn(args: TokenStream, input: TokenStream) -> TokenStream { tokens.into() } -#[proc_macro_hack] +#[proc_macro] #[proc_macro_error] pub fn stack_producer(input: TokenStream) -> TokenStream { let mut input = parse_macro_input!(input as ExprBlock); @@ -76,7 +73,7 @@ pub fn sync_producer_fn(args: TokenStream, input: TokenStream) -> TokenStream { tokens.into() } -#[proc_macro_hack] +#[proc_macro] #[proc_macro_error] pub fn sync_producer(input: TokenStream) -> TokenStream { let mut input = parse_macro_input!(input as ExprBlock); @@ -109,7 +106,7 @@ pub fn rc_producer_fn(args: TokenStream, input: TokenStream) -> TokenStream { tokens.into() } -#[proc_macro_hack] +#[proc_macro] #[proc_macro_error] pub fn rc_producer(input: TokenStream) -> TokenStream { let mut input = parse_macro_input!(input as ExprBlock); diff --git a/src/lib.rs b/src/lib.rs index 8bc012f..6b9131c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -205,7 +205,7 @@ genawaiter = { version = "...", features = ["futures03"] } ```rust # #[cfg(all(feature = "proc_macro", feature = "futures03"))] # fn feature_gate() { -# use futures::executor::block_on_stream; +# use futures_executor::block_on_stream; # use genawaiter::{sync::gen, yield_}; # async fn async_one() -> i32 { 1 } @@ -266,9 +266,6 @@ extern crate self as genawaiter; pub use crate::ops::{Coroutine, Generator, GeneratorState}; -#[cfg(feature = "proc_macro")] -use proc_macro_hack::proc_macro_hack; - /// Creates a producer for use with [`sync::Gen`]. /// /// A producer can later be turned into a generator using @@ -290,7 +287,6 @@ use proc_macro_hack::proc_macro_hack; /// # my_generator.resume(); /// ``` #[cfg(feature = "proc_macro")] -#[proc_macro_hack] pub use genawaiter_proc_macro::sync_producer; /// Creates a producer for use with [`rc::Gen`]. @@ -314,12 +310,10 @@ pub use genawaiter_proc_macro::sync_producer; /// # my_generator.resume(); /// ``` #[cfg(feature = "proc_macro")] -#[proc_macro_hack] pub use genawaiter_proc_macro::rc_producer; #[doc(hidden)] // This is not quite usable currently, so hide it for now. #[cfg(feature = "proc_macro")] -#[proc_macro_hack] pub use genawaiter_proc_macro::stack_producer; mod core; diff --git a/src/rc/stream.rs b/src/rc/stream.rs index 525c64f..a144a67 100644 --- a/src/rc/stream.rs +++ b/src/rc/stream.rs @@ -28,7 +28,8 @@ mod tests { rc::{Co, Gen}, testing::SlowFuture, }; - use futures::{executor::block_on_stream, stream}; + use futures_executor::block_on_stream; + use futures_util::stream; #[test] fn blocking() { diff --git a/src/stack/nightly_tests.rs b/src/stack/nightly_tests.rs index fb08be0..6c1d96f 100644 --- a/src/stack/nightly_tests.rs +++ b/src/stack/nightly_tests.rs @@ -5,7 +5,7 @@ use crate::{ops::GeneratorState, stack::let_gen_using}; #[test] fn async_closure() { - let_gen_using!(gen, async move |co| { + let_gen_using!(gen, async move |mut co| { co.yield_(10).await; "done" }); diff --git a/src/stack/stream.rs b/src/stack/stream.rs index 92b8a94..d1b5fb5 100644 --- a/src/stack/stream.rs +++ b/src/stack/stream.rs @@ -28,7 +28,8 @@ mod tests { stack::{let_gen_using, Co}, testing::SlowFuture, }; - use futures::{executor::block_on_stream, stream}; + use futures_executor::block_on_stream; + use futures_util::stream; #[test] fn blocking() { diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 16eaa52..bcfb80d 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -354,7 +354,7 @@ mod tests { testing::{DummyFuture, SlowFuture}, GeneratorState, }; - use futures::executor::block_on; + use futures_executor::block_on; use std::{ cell::{Cell, RefCell}, future::Future, diff --git a/src/sync/stream.rs b/src/sync/stream.rs index c233827..5d95261 100644 --- a/src/sync/stream.rs +++ b/src/sync/stream.rs @@ -28,7 +28,8 @@ mod tests { sync::{Co, Gen}, testing::SlowFuture, }; - use futures::{executor::block_on_stream, stream}; + use futures_executor::block_on_stream; + use futures_util::stream; #[test] fn blocking() { diff --git a/tests/rc.rs b/tests/rc.rs index 4a98ff0..0280c86 100644 --- a/tests/rc.rs +++ b/tests/rc.rs @@ -20,7 +20,7 @@ fn test_basic() { #[cfg(feature = "futures03")] #[test] fn test_stream() { - use futures::executor::block_on_stream; + use futures_executor::block_on_stream; let gen = Gen::new(odd_numbers_less_than_ten); let xs: Vec<_> = block_on_stream(gen).collect(); diff --git a/tests/stack.rs b/tests/stack.rs index a687bc3..cb53fb3 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -30,7 +30,7 @@ fn test_shelf() { #[cfg(feature = "futures03")] #[test] fn test_stream() { - use futures::executor::block_on_stream; + use futures_executor::block_on_stream; let_gen_using!(gen, odd_numbers_less_than_ten); let xs: Vec<_> = block_on_stream(gen).collect(); diff --git a/tests/sync.rs b/tests/sync.rs index dc7ee57..13bca8a 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -27,7 +27,7 @@ fn test_boxed() { #[cfg(feature = "futures03")] #[test] fn test_stream() { - use futures::executor::block_on_stream; + use futures_executor::block_on_stream; let gen = Gen::new(odd_numbers_less_than_ten); let xs: Vec<_> = block_on_stream(gen).collect(); diff --git a/tests/ui/stack_fail_not_awaiting_yield.rs b/tests/ui/stack_fail_not_awaiting_yield.rs index 5989106..6aabab3 100644 --- a/tests/ui/stack_fail_not_awaiting_yield.rs +++ b/tests/ui/stack_fail_not_awaiting_yield.rs @@ -1,7 +1,7 @@ -use genawaiter::{stack::Co}; +use genawaiter::stack::Co; #[allow(unused_variables)] -async fn wrong(mut co: Co) { +async fn wrong(mut co: Co<'_, i32>) { let foo = co.yield_(10); let bar = co.yield_(20); } diff --git a/tests/ui/stack_fail_not_awaiting_yield.stderr b/tests/ui/stack_fail_not_awaiting_yield.stderr index cbbe3b7..0ac6a7e 100644 --- a/tests/ui/stack_fail_not_awaiting_yield.stderr +++ b/tests/ui/stack_fail_not_awaiting_yield.stderr @@ -1,5 +1,9 @@ -error[E0726]: implicit elided lifetime not allowed here - --> $DIR/stack_fail_not_awaiting_yield.rs:4:24 +error[E0499]: cannot borrow `co` as mutable more than once at a time + --> $DIR/stack_fail_not_awaiting_yield.rs:6:15 | -4 | async fn wrong(mut co: Co) { - | ^^^^^^^ help: indicate the anonymous lifetime: `Co<'_, i32>` +5 | let foo = co.yield_(10); + | -- first mutable borrow occurs here +6 | let bar = co.yield_(20); + | ^^ second mutable borrow occurs here +7 | } + | - first borrow might be used here, when `foo` is dropped and runs the destructor for type `impl std::future::Future` diff --git a/tests/ui/stack_fail_when_co_is_static.stderr b/tests/ui/stack_fail_when_co_is_static.stderr index 2b452d0..90428ad 100644 --- a/tests/ui/stack_fail_when_co_is_static.stderr +++ b/tests/ui/stack_fail_when_co_is_static.stderr @@ -10,4 +10,4 @@ error[E0597]: `shelf` does not live long enough 10 | } | - `shelf` dropped here while still borrowed | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) From 8b21e28be9a00deb4f63c7fb2b528a143e890895 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 23 Sep 2020 13:03:03 -0700 Subject: [PATCH 2/2] Fix clippy warnings --- examples/error_propagation.rs | 2 +- genawaiter-proc-macro/src/lib.rs | 13 ++++++------- tests/rc.rs | 4 ++-- tests/stack.rs | 4 ++-- tests/sync.rs | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/examples/error_propagation.rs b/examples/error_propagation.rs index 6cb6d71..0f897f9 100644 --- a/examples/error_propagation.rs +++ b/examples/error_propagation.rs @@ -25,7 +25,7 @@ fn main() -> Result<(), Box> { let counter = gen!({ for num in 0..10 { // Perform some fallible operation, and yield the result (or the error) - let string = yield_!(process(num)); + yield_!(process(num)); } }); diff --git a/genawaiter-proc-macro/src/lib.rs b/genawaiter-proc-macro/src/lib.rs index 454cfbf..616559a 100644 --- a/genawaiter-proc-macro/src/lib.rs +++ b/genawaiter-proc-macro/src/lib.rs @@ -161,17 +161,16 @@ fn add_coroutine_arg(func: &mut ItemFn, co_ty: &str) { } } }); - if !co_arg_found { - let co_arg: FnArg = match parse_str::(co_ty) { - Ok(s) => s, - Err(err) => abort_call_site!(format!("invalid type for Co yield {}", err)), - }; - func.sig.inputs.push_value(co_arg) - } else { + if co_arg_found { abort!( func.sig.span(), "A generator producer cannot accept any arguments. Instead, consider \ using a closure and capturing the values you need.", ) } + let co_arg: FnArg = match parse_str::(co_ty) { + Ok(s) => s, + Err(err) => abort_call_site!(format!("invalid type for Co yield {}", err)), + }; + func.sig.inputs.push_value(co_arg) } diff --git a/tests/rc.rs b/tests/rc.rs index 0280c86..0be1b1c 100644 --- a/tests/rc.rs +++ b/tests/rc.rs @@ -119,9 +119,9 @@ fn rc_convenience_macro_resume() { use genawaiter::{rc::gen, yield_, GeneratorState}; let mut gen = gen!({ - let resume_arg = yield_!(10_u8); + let mut resume_arg = yield_!(10_u8); assert_eq!(resume_arg, "abc"); - let resume_arg = yield_!(20_u8); + resume_arg = yield_!(20_u8); assert_eq!(resume_arg, "def"); }); diff --git a/tests/stack.rs b/tests/stack.rs index cb53fb3..334976c 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -180,9 +180,9 @@ fn stack_convenience_macro_resume() { use genawaiter::{stack::let_gen, yield_, GeneratorState}; let_gen!(gen, { - let resume_arg = yield_!(10_u8); + let mut resume_arg = yield_!(10_u8); assert_eq!(resume_arg, "abc"); - let resume_arg = yield_!(20_u8); + resume_arg = yield_!(20_u8); assert_eq!(resume_arg, "def"); }); diff --git a/tests/sync.rs b/tests/sync.rs index 13bca8a..88d5be5 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -105,9 +105,9 @@ fn sync_convenience_macro_resume() { use genawaiter::{sync::gen, yield_, GeneratorState}; let mut gen = gen!({ - let resume_arg = yield_!(10_u8); + let mut resume_arg = yield_!(10_u8); assert_eq!(resume_arg, "abc"); - let resume_arg = yield_!(20_u8); + resume_arg = yield_!(20_u8); assert_eq!(resume_arg, "def"); });