Skip to content
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

yield can only be used in #[coroutine] closures, or gen blocks #342

Closed
rotteegher opened this issue May 21, 2024 · 1 comment
Closed

yield can only be used in #[coroutine] closures, or gen blocks #342

rotteegher opened this issue May 21, 2024 · 1 comment

Comments

@rotteegher
Copy link
Contributor

rotteegher commented May 21, 2024

I just cloned the repo and followed the docs, but got a build error.

Build Error:

❯ make release
cd bins && make release
make[1]: Entering directory '/home/rot/pr/rustpr/ln/zirka-game/Ayaka/bins'
cd ayaka-gui && make dist
make[2]: Entering directory '/home/rot/pr/rustpr/ln/zirka-game/Ayaka/bins/ayaka-gui'
npm run build

> ayaka-gui@0.3.0 build
> vue-tsc --noEmit && vite build

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.2.8 building for production...
✓ 583 modules transformed.
dist/index.html                                      0.53 kB │ gzip:   0.31 kB
dist/assets/logo-BqsntNQU.png                      112.66 kB
dist/assets/HomeView-DTwHsAOL.css                    0.03 kB │ gzip:   0.05 kB
dist/assets/RecordsView-B3RBQaA4.css                 0.03 kB │ gzip:   0.05 kB
dist/assets/ActionCard-B5a5i_jp.css                  0.04 kB │ gzip:   0.05 kB
dist/assets/HistoryView-Cm11hHN9.css                 0.04 kB │ gzip:   0.06 kB
dist/assets/IconButton-CMvdm4Y9.css                  0.04 kB │ gzip:   0.05 kB
dist/assets/GameView-CxJqrRFa.css                    0.52 kB │ gzip:   0.26 kB
dist/assets/index-CV9BwKjb.css                     207.60 kB │ gzip:  31.15 kB
dist/assets/_plugin-vue_export-helper-DlAUqK2U.js    0.09 kB │ gzip:   0.10 kB
dist/assets/IconButton-Dy8dlJx0.js                   0.46 kB │ gzip:   0.34 kB
dist/assets/ActionCard-BbKz-Deh.js                   0.59 kB │ gzip:   0.35 kB
dist/assets/HistoryView-20UorKu7.js                  0.73 kB │ gzip:   0.49 kB
dist/assets/RecordsView-CwIsILYb.js                  1.22 kB │ gzip:   0.67 kB
dist/assets/AboutView-DK5yCQaG.js                    1.37 kB │ gzip:   0.70 kB
dist/assets/HomeView-Bm9Ttf49.js                     1.41 kB │ gzip:   0.75 kB
dist/assets/SettingsView-BS0K_-EJ.js                 3.04 kB │ gzip:   1.12 kB
dist/assets/GameView-BuKbhcrJ.js                   303.55 kB │ gzip:  97.26 kB
dist/assets/index-BMDa-cU6.js                      729.96 kB │ gzip: 216.68 kB
✓ built in 6.32s
make[2]: Leaving directory '/home/rot/pr/rustpr/ln/zirka-game/Ayaka/bins/ayaka-gui'
cargo build --release
   Compiling ayaka-runtime v0.3.0 (/home/rot/pr/rustpr/ln/zirka-game/Ayaka/utils/ayaka-runtime)
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
   --> /home/rot/pr/rustpr/ln/zirka-game/Ayaka/utils/ayaka-runtime/src/context.rs:142:5
    |
142 |     #[stream(OpenStatus, lifetime = 'a)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the attribute macro `stream` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use `#[coroutine]` to make this closure a coroutine
    |
142 |     #[coroutine] #[stream(OpenStatus, lifetime = 'a)]
    |     ++++++++++++

error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
  --> /home/rot/pr/rustpr/ln/zirka-game/Ayaka/utils/ayaka-runtime/src/plugin.rs:93:5
   |
93 |     #[stream(LoadStatus, lifetime = 'a)]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the attribute macro `stream` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use `#[coroutine]` to make this closure a coroutine
   |
93 |     #[coroutine] #[stream(LoadStatus, lifetime = 'a)]
   |     ++++++++++++

error: could not compile `ayaka-runtime` (lib) due to 2 previous errors
make[1]: *** [Makefile:14: release] Error 101
make[1]: Leaving directory '/home/rot/pr/rustpr/ln/zirka-game/Ayaka/bins'
make: *** [Makefile:28: release] Error 2

I tried adding the #[coroutine] blocks to the lines in the error above, but that didn't fix the issue.

@rotteegher rotteegher changed the title yield can only be used in #[coroutine] closures or gen blocks yield can only be used in #[coroutine] closures, or gen blocks May 21, 2024
@Berrysoft
Copy link
Contributor

Coroutine syntax changed. I'll address that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants