From bf54d4dc2b08fe1103fc9d6a5979746ffc136f82 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Fri, 5 Aug 2022 11:43:50 +0200 Subject: [PATCH] Fix xtask for async --- .github/workflows/build.yml | 19 ++++++++++--------- ci/expected/async-delay.run | 7 +++++++ ci/expected/async-infinite-loop.run | 6 ++++++ ci/expected/async-task-multiple-prios.run | 5 +++++ ci/expected/async-task.run | 3 +++ ci/expected/async-timeout.run | 5 +++++ macros/src/check.rs | 2 +- macros/src/codegen/dispatchers.rs | 13 +++++-------- 8 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 ci/expected/async-delay.run create mode 100644 ci/expected/async-infinite-loop.run create mode 100644 ci/expected/async-task-multiple-prios.run create mode 100644 ci/expected/async-task.run create mode 100644 ci/expected/async-timeout.run diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 875c3f39d1..02b7f4fadb 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 0000000000..61852abfd9 --- /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 0000000000..f9fd4e494c --- /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 0000000000..9b0f53365b --- /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 0000000000..f7ce3a6065 --- /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 0000000000..a8074230ee --- /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 4b360738f5..74df688c58 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -43,7 +43,7 @@ pub fn app(app: &App, _analysis: &Analysis) -> parse::Result { 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 62df429370..6b241140a7 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