diff options
author | 2022-08-05 11:43:50 +0200 | |
---|---|---|
committer | 2022-08-05 11:52:41 +0200 | |
commit | bf54d4dc2b08fe1103fc9d6a5979746ffc136f82 (patch) | |
tree | f182d3a11d8830e5c75172637ac79041f942706d | |
parent | 46a3f2befd6fd821e5747ce9db112c550bc989f3 (diff) | |
download | rtic-bf54d4dc2b08fe1103fc9d6a5979746ffc136f82.tar.gz rtic-bf54d4dc2b08fe1103fc9d6a5979746ffc136f82.tar.zst rtic-bf54d4dc2b08fe1103fc9d6a5979746ffc136f82.zip |
Fix xtask for async
-rw-r--r-- | .github/workflows/build.yml | 19 | ||||
-rw-r--r-- | ci/expected/async-delay.run | 7 | ||||
-rw-r--r-- | ci/expected/async-infinite-loop.run | 6 | ||||
-rw-r--r-- | ci/expected/async-task-multiple-prios.run | 5 | ||||
-rw-r--r-- | ci/expected/async-task.run | 3 | ||||
-rw-r--r-- | ci/expected/async-timeout.run | 5 | ||||
-rw-r--r-- | macros/src/check.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/dispatchers.rs | 13 |
8 files changed, 42 insertions, 18 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 875c3f39..02b7f4fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: nightly override: true components: rustfmt @@ -49,7 +49,7 @@ jobs: - thumbv6m-none-eabi - x86_64-unknown-linux-gnu toolchain: - - stable + - nightly steps: - name: Checkout uses: actions/checkout@v2 @@ -82,12 +82,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install Rust stable + - name: Install Rust nightly uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly target: x86_64-unknown-linux-gnu override: true + components: clippy - name: Fail on warnings run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs @@ -111,7 +112,7 @@ jobs: - thumbv7m-none-eabi - thumbv6m-none-eabi toolchain: - - stable + - nightly steps: - name: Checkout uses: actions/checkout@v2 @@ -144,7 +145,7 @@ jobs: - thumbv7m-none-eabi - thumbv6m-none-eabi toolchain: - - stable + - nightly steps: - name: Checkout uses: actions/checkout@v2 @@ -188,7 +189,7 @@ jobs: target: - x86_64-unknown-linux-gnu toolchain: - - stable + - nightly steps: - name: Checkout uses: actions/checkout@v2 @@ -224,7 +225,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly target: x86_64-unknown-linux-gnu override: true @@ -252,7 +253,7 @@ jobs: - name: Install Rust uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly target: x86_64-unknown-linux-gnu override: true diff --git a/ci/expected/async-delay.run b/ci/expected/async-delay.run new file mode 100644 index 00000000..61852abf --- /dev/null +++ b/ci/expected/async-delay.run @@ -0,0 +1,7 @@ +init +hello from bar +hello from baz +hello from foo +bye from foo +bye from bar +bye from baz diff --git a/ci/expected/async-infinite-loop.run b/ci/expected/async-infinite-loop.run new file mode 100644 index 00000000..f9fd4e49 --- /dev/null +++ b/ci/expected/async-infinite-loop.run @@ -0,0 +1,6 @@ +init +hello from async 0 +hello from async 1 +hello from async 2 +hello from async 3 +hello from async 4 diff --git a/ci/expected/async-task-multiple-prios.run b/ci/expected/async-task-multiple-prios.run new file mode 100644 index 00000000..9b0f5336 --- /dev/null +++ b/ci/expected/async-task-multiple-prios.run @@ -0,0 +1,5 @@ +init +hello from normal 2 +hello from async 2 +hello from normal 1 +hello from async 1 diff --git a/ci/expected/async-task.run b/ci/expected/async-task.run new file mode 100644 index 00000000..f7ce3a60 --- /dev/null +++ b/ci/expected/async-task.run @@ -0,0 +1,3 @@ +init +hello from normal +hello from async diff --git a/ci/expected/async-timeout.run b/ci/expected/async-timeout.run new file mode 100644 index 00000000..a8074230 --- /dev/null +++ b/ci/expected/async-timeout.run @@ -0,0 +1,5 @@ +init +hello from bar +hello from foo +foo no timeout +bar timeout diff --git a/macros/src/check.rs b/macros/src/check.rs index 4b360738..74df688c 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -43,7 +43,7 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result<Extra> { let need = priorities .iter() // Only count if not 0 - .filter_map(|prio| if *prio > 0 { Some(prio) } else { None }) + .filter(|prio| **prio > 0) .count(); let given = app.args.extern_interrupts.len(); if need > given { diff --git a/macros/src/codegen/dispatchers.rs b/macros/src/codegen/dispatchers.rs index 62df4293..6b241140 100644 --- a/macros/src/codegen/dispatchers.rs +++ b/macros/src/codegen/dispatchers.rs @@ -183,14 +183,11 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream } )); - for name in channel.tasks.iter().filter_map(|name| { - let task = &app.software_tasks[name]; - if task.is_async { - Some(name) - } else { - None - } - }) { + for name in channel + .tasks + .iter() + .filter(|name| app.software_tasks[*name].is_async) + { let exec_name = util::internal_task_ident(name, "EXEC"); let executor_run_ident = util::executor_run_ident(name); |