From 10df29ed113c5b5cf3887eaefc0fae9351080a75 Mon Sep 17 00:00:00 2001 From: har7an <99636919+har7an@users.noreply.github.com> Date: Sat, 25 Jan 2025 17:43:49 +0000 Subject: [PATCH] Update rust toolchain to 1.84 (#3945) * chore: Remove deprecated `Makefile.toml` which really should have been deleted as part of #2012. This hasn't been updated for more than 2 years now and I don't expect anyone to still use this. Our build process is now managed by `cargo xtask`. * Cargo: Update the Rust toolchain to 1.84.0 from 1.75.0 which has been deprecated for a while now. Along with this change, the `wasm32-wasi` target is no longer available (see subsequent commit for additional info). * chore: Rename `wasm32-wasi` to `wasm32-wasip1` as required by the Rust project. The `wasm32-wasi` target name has been retired and will likely be reused at a later time, although to express an entirely different target (i.e. implementation of the WASI standard). For additional information, see: - https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html - https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#wasi-01-target-naming-changed * chore: Drop `rust-analysis` component from the `rust-toolchain.toml` definition. This was added way back in 2021 via 8688569a, and while I'm not sure what it expressed back then, nowadays it refers to [Metadata for RLS][1], which apparently was an early language server implementation and has long since been replaced by *rust-analyzer*. We don't want to propose or enforce the use of a specific toolchain and in any case, setting this up properly is the job of a developers IDE/Editor. [1]: https://github.com/rust-lang/rustup/blob/1f06e3b31d444f3649dd51225a9d38362f7313e0/doc/user-guide/src/concepts/components.md#previous-components * chore: Adhere to type rename from `std::panic::PanicInfo` to `std::panic::PanicHookInfo`, which was introduced in Rust 1.81.0. For additional information, see: - https://releases.rs/docs/1.81.0/#compatibility-notes - https://github.com/rust-lang/rust/pull/115974/ * fix(utils/data): Adhere to expected case in match arm patterns, since the expression being matched against has been modified using `to_ascii_lowercase`. Hence, we cannot have upper case ASCII chars in the expressions (these arms were previously no-ops). * fix(utils): Derive `Hash` manually in `input/layout` since the `PartialEq` trait is also implemented manually. Previously the `Hash` impl wasn't consistent with the `Eq` impl, which can have weird effects when using these types in e.g. `HashMap`s or similar types. For additional information, see: - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq * fix(utils): Derive `Hash` manually in `pane_size` since the `PartialEq` trait is also implemented manually. Previously the `Hash` impl wasn't consistent with the `Eq` impl, which can have weird effects when using these types in e.g. `HashMap`s or similar types. For additional information, see: - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq * fix(server): Don't redeclare variables with their same names. Latest rust toolchains reject this code. * chore(actions): Use non-archived toolchain setup for the Rust toolchain. The previously used action has been archived over a year ago. The new one should also support reading our `rust-toolchain.toml`, so we no longer have to keep track of the toolchain in multiple places. * chore(actions): Add some space to YAML files to make them better visually parsable. * ci: Remove toolchain update Job since as far as I can tell, this isn't used any more. * ci: Fix invalid actions specification and only request an action without running other code. * CHANGELOG: Add PR #3945. --- .github/workflows/e2e.yml | 17 +- .github/workflows/release.yml | 38 +-- .github/workflows/rust.yml | 21 +- .github/workflows/update-rust-toolchain.yml | 25 -- CHANGELOG.md | 1 + Cargo.toml | 2 +- Makefile.toml | 284 ------------------ .../compact-bar/.cargo/config.toml | 2 +- .../configuration/.cargo/config.toml | 2 +- .../.cargo/config.toml | 2 +- .../plugin-manager/.cargo/config.toml | 2 +- .../session-manager/.cargo/config.toml | 2 +- default-plugins/status-bar/.cargo/config.toml | 2 +- default-plugins/strider/.cargo/config.toml | 2 +- default-plugins/tab-bar/.cargo/config.toml | 2 +- rust-toolchain.toml | 7 +- .../configs/load_background_plugins.kdl | 2 +- xtask/src/build.rs | 2 +- xtask/src/test.rs | 4 +- zellij-server/src/plugins/wasm_bridge.rs | 2 - zellij-tile/src/shim.rs | 2 +- zellij-utils/src/consts.rs | 4 +- zellij-utils/src/data.rs | 4 +- zellij-utils/src/errors.rs | 4 +- zellij-utils/src/input/layout.rs | 11 +- zellij-utils/src/pane_size.rs | 14 +- 26 files changed, 88 insertions(+), 372 deletions(-) delete mode 100644 .github/workflows/update-rust-toolchain.yml delete mode 100644 Makefile.toml diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2d842326..77d8b16b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -30,26 +30,29 @@ jobs: options: -v ${{ github.workspace }}/target:/usr/src/zellij --name ssh steps: - uses: actions/checkout@v3 + - name: Install Protoc uses: arduino/setup-protoc@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Add WASM target - run: rustup target add wasm32-wasi + - name: Install musl-tools run: sudo apt-get install -y --no-install-recommends musl-tools - - name: Add musl target - run: rustup target add x86_64-unknown-linux-musl - #run: cargo install --debug cargo-make - - uses: Swatinem/rust-cache@v2 - # ensure the target folder exists, otherwise fixtures won't be in the right place + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rustflags: "" + - name: Create target folder run: mkdir -p ${{ github.workspace }}/target # we copy this manually into the target folder instead of mounting it because # github actions creates the service first, and if it has a mount that is part # of your yet unchecked out code, you cannot checkout the code after the mount + - name: Copy fixtures folder to target run: cp -r ${{ github.workspace }}/src/tests/fixtures ${{ github.workspace }}/target + - name: Restart ssh container # we need to do this because otherwise the volume will not be mounted # on the docker container, since it was created before the folder existed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f8537da..260f5b98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,28 +53,18 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - profile: minimal - override: true - target: ${{ matrix.target }} - - - name: Add WASM target - run: rustup target add wasm32-wasi - - name: Install musl-tools if: matrix.os == 'ubuntu-latest' run: sudo apt-get install -y --no-install-recommends musl-tools - - # Workaround for - - name: Switch Xcode SDK - if: runner.os == 'macos' - run: | - cat <> "$GITHUB_ENV" - SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk - EOF + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + target: "${{ matrix.target }},wasm32-wasip1" + # Just to make sure the cache doesn't interfere with the build here + cache: false + rustflags: "" - name: Build release binary run: cargo xtask ci cross ${{ matrix.target }} @@ -109,7 +99,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create-release.outputs.upload_url }} + upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-artifact.outputs.name }} asset_name: zellij-${{matrix.target}}.tar.gz asset_content_type: application/octet-stream @@ -119,17 +109,17 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ needs.create-release.outputs.upload_url }} + upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-checksum.outputs.name }} asset_name: zellij-${{matrix.target}}.sha256sum asset_content_type: text/plain create-release: runs-on: ubuntu-latest - outputs: + outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - - name: create_release + - name: create_release id: create_release uses: actions/create-release@v1 env: @@ -138,5 +128,5 @@ jobs: tag_name: ${{ github.event_name == 'workflow_dispatch' && '' || github.ref }} release_name: Release ${{ github.event_name == 'workflow_dispatch' && 'main' || github.ref }} draft: ${{ github.event_name == 'workflow_dispatch' }} - prerelease: false + prerelease: false diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 87109035..86f2a0f3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,14 +22,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install Protoc uses: arduino/setup-protoc@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Setup toolchain - run: rustup show - - uses: Swatinem/rust-cache@v2 + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rustflags: "" + - name: Build run: cargo xtask build @@ -45,13 +48,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install Protoc uses: arduino/setup-protoc@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup toolchain - run: rustup show - - uses: Swatinem/rust-cache@v2 + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rustflags: "" + - name: Test run: cargo xtask test @@ -61,7 +68,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Setup toolchain - run: rustup show + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rustflags: "" + - name: Check Format run: cargo xtask format --check diff --git a/.github/workflows/update-rust-toolchain.yml b/.github/workflows/update-rust-toolchain.yml deleted file mode 100644 index 0fcb3662..00000000 --- a/.github/workflows/update-rust-toolchain.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: update-rust-toolchain -on: - workflow_dispatch: # allows manual triggering - schedule: - - cron: '0 0 1 * *' # runs on the first of every month at 00:00 - -jobs: - update-rust-toolchain: - name: "Update rust-toolchain" - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: update rust toolchain - id: urt - uses: a-kenji/update-rust-toolchain@v1.1 - with: - minor-version-delta: 2 - toolchain-path: './rust-toolchain.toml' - token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} - pr-labels: | - dependencies - automated - rust diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a15c53b..3ee6ace4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * feat(terminal): mouse AnyEvent tracking (https://github.com/zellij-org/zellij/pull/3538) * fix(terminal): support setting kitty keyboard protocol with `CSI=` (https://github.com/zellij-org/zellij/pull/3942) * fix(floating-panes): handle various errors (https://github.com/zellij-org/zellij/pull/3944) +* chore(rust): Update Rust toolchain to 1.84.0 (https://github.com/zellij-org/zellij/pull/3945) ## [0.41.2] - 2024-11-19 * fix(input): keypresses not being identified properly with kitty keyboard protocol in some terminals (https://github.com/zellij-org/zellij/pull/3725) diff --git a/Cargo.toml b/Cargo.toml index ea1b3cbc..d35ca2e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/zellij-org/zellij" homepage = "https://zellij.dev" include = ["src/**/*", "assets/layouts/*", "assets/config/*", "LICENSE.md", "README.md", "!**/*_test.*", "!**/tests/**/*"] # NOTE: When updating this, modify `channel` in `rust-toolchain.toml` accordingly -rust-version = "1.75" +rust-version = "1.84" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/Makefile.toml b/Makefile.toml deleted file mode 100644 index bc433cbb..00000000 --- a/Makefile.toml +++ /dev/null @@ -1,284 +0,0 @@ -# Global Settings -[env] -CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true -CARGO_TARGET_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target" -SKIP_TEST = false -ZELLIJ_EXAMPLE_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/example" -ZELLIJ_ASSETS_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets" - -# Add clippy to the default flow -[tasks.dev-test-flow] -dependencies = [ - "plugins", - "format-flow", - "format-toml-conditioned-flow", - "pre-build", - "build", - "post-build", - "test-flow", - "clippy", -] - -[tasks.test] -dependencies = ["get-host-triple"] -args = ["test", "--target", "${CARGO_HOST_TRIPLE}", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"] - -# Running Zellij using the development data directory -[tasks.run] -workspace = false -dependencies = ["build-workspace"] -run_task = "launch" - -[tasks.build-workspace] -run_task = { name = "build", fork = true } - -[tasks.build] -env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = "default-plugins*" } -args = ["build"] - -[tasks.build-release] -args = ["build", "--release"] - -[tasks.build-e2e-data-dir] -dependencies = ["plugins-release"] -script_runner = "@duckscript" -script = ''' -target_dir = set ${CARGO_TARGET_DIR} -data_dir = set ${target_dir}/e2e-data -rm -r ${data_dir} -plugins = glob_array ${target_dir}/wasm32-wasi/release/*.wasm -mkdir ${data_dir} -mkdir ${data_dir}/plugins -for plugin in ${plugins} - plugin_name = basename ${plugin} - cp ${plugin} ${data_dir}/plugins/${plugin_name} -end -writefile ${data_dir}/VERSION ${CARGO_MAKE_CRATE_VERSION} -''' - -[tasks.launch] -command = "cargo" -args = [ - "run", - "--", - "--data-dir", - "${CARGO_TARGET_DIR}/dev-data/", - "@@split(CARGO_MAKE_TASK_ARGS,;)", -] - -# Simple clippy tweak -[tasks.clippy] -dependencies = ["plugins"] -args = ["clippy", "--all-targets", "--all-features", "@@split(CARGO_MAKE_TASK_ARGS,;)"] - -# Release building and installing Zellij -[tasks.install] -workspace = false -dependencies = ["wasm-opt-plugins", "build-release", "manpage"] -script_runner = "@duckscript" -script = ''' -if is_dir ${CARGO_MAKE_TASK_ARGS} - trigger_error "You need to specify a full path for the binary, not just a directory!" -else - cp ${CARGO_TARGET_DIR}/release/${CARGO_MAKE_CRATE_NAME} ${CARGO_MAKE_TASK_ARGS} -end -''' - -[tasks.wasm-opt-plugins] -alias = "plugins-release" - -[tasks.plugins-release] -workspace = false -script_runner = "@duckscript" -script = ''' -plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/* -out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/ -mkdir ${out_dir} - -for plugin in ${plugins} - cd ${plugin} - exec cargo build --release - plugin_name = basename ${plugin} - plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/release/${plugin_name}.wasm - plugin_out = set ${out_dir}/${plugin_name}.wasm - exec wasm-opt -O ${plugin_in} -o ${plugin_out} - cd .. -end -''' - -[tasks.plugins] -workspace = false -script_runner = "@duckscript" -script = ''' -plugins = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/default-plugins/* -out_dir = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/zellij-utils/assets/plugins/ -mkdir ${out_dir} - -for plugin in ${plugins} - cd ${plugin} - exec cargo build - plugin_name = basename ${plugin} - plugin_in = set ${CARGO_TARGET_DIR}/wasm32-wasi/debug/${plugin_name}.wasm - plugin_out = set ${out_dir}/${plugin_name}.wasm - cp ${plugin_in} ${plugin_out} - cd .. -end -''' - -[tasks.get-host-triple] -script_runner = "@duckscript" -script = ''' -output = exec rustc -v -V -lines = split ${output.stdout} \n -triple = set "" -for line in ${lines} - if starts_with ${line} "host:" && not is_empty ${line} - bits = split ${line} " " - triple = array_get ${bits} 1 - triple = set ${triple} - end -end - -if not is_empty ${triple} - set_env CARGO_HOST_TRIPLE "${triple}" -end -''' - -[tasks.manpage] -workspace = false -description = "Use mandown crate to create or update man entry from docs/MANPAGES.md" -script = ''' -root_dir=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY} -mkdir -p ${root_dir}/assets/man -mandown ${root_dir}/docs/MANPAGE.md ZELLIJ 1 > ${root_dir}/assets/man/zellij.1 -''' -dependencies = ["install-mandown"] - -[tasks.install-mandown] -command = "cargo" -args = ["install", "mandown"] - - -# copy the example default config from assets directory to a more user facing one -[tasks.update-default-config] -workspace = false -dependencies = [] -script_runner = "@duckscript" -script = ''' -cp ${ZELLIJ_ASSETS_DIR}/config/default.kdl ${ZELLIJ_EXAMPLE_DIR}/default.kdl -''' - -# CI Releasing Zellij -[tasks.ci-build-release] -workspace = false -dependencies = [ - "plugins-release", - "setup-cross-compilation", - "manpage", -] -command = "cross" -args = [ - "build", - "--verbose", - "--release", - "--target", - "${CARGO_MAKE_TASK_ARGS}", -] - -# Build e2e asset -[tasks.build-e2e] -workspace = false -dependencies = ["wasm-opt-plugins", "build-e2e-data-dir"] -command = "cargo" -args = [ - "build", - "--verbose", - "--release", - "--target", - "x86_64-unknown-linux-musl", -] - -# Run e2e tests - we mark the e2e tests as "ignored" so they will not be run with the normal ones -[tasks.e2e-test] -workspace = false -dependencies = ["build-e2e", "plugins"] -command = "cargo" -args = [ - "test", - "--", - "--ignored", - "--nocapture", - "--test-threads", - "1", - "@@split(CARGO_MAKE_TASK_ARGS,;)", -] - -[tasks.setup-cross-compilation] -command = "cargo" -args = ["install", "cross"] - -# Publishing Zellij -[tasks.publish] -clear = true -workspace = false -dependencies = [ - "plugins-release", - "update-default-config", - "release-commit", -] -run_task = "publish-zellij" - -[tasks.release-commit] -dependencies = ["commit-all", "tag-release"] -command = "git" -args = ["push", "--atomic", "origin", "main", "v${CARGO_MAKE_CRATE_VERSION}"] - -[tasks.commit-all] -ignore_errors = true -dependencies = ["plugins-release"] -command = "git" -args = ["commit", "-aem", "chore(release): v${CARGO_MAKE_CRATE_VERSION}"] - -[tasks.tag-release] -command = "git" -args = ["tag", "--annotate", "--message", "Version ${CARGO_MAKE_CRATE_VERSION}", "v${CARGO_MAKE_CRATE_VERSION}"] - -[tasks.publish-zellij-tile] -ignore_errors = true -dependencies = ["publish-zellij-utils"] -cwd = "zellij-tile" -script = "cargo publish && sleep 15" - -[tasks.publish-zellij-client] -ignore_errors = true -dependencies = ["publish-zellij-utils"] -cwd = "zellij-client" -script = "cargo publish && sleep 15" - -[tasks.publish-zellij-server] -ignore_errors = true -dependencies = ["publish-zellij-utils"] -cwd = "zellij-server" -script = "cargo publish && sleep 15" - -[tasks.publish-zellij-utils] -ignore_errors = true -dependencies = ["publish-zellij-utils"] -cwd = "zellij-utils" -script = "cargo publish && sleep 15" - -[tasks.publish-zellij-tile-utils] -ignore_errors = true -cwd = "zellij-tile-utils" -script = "cargo publish && sleep 15" - -[tasks.publish-zellij] -dependencies = [ - "publish-zellij-utils", - "publish-zellij-tile-utils", - "publish-zellij-tile", - "publish-zellij-client", - "publish-zellij-server", -] -command = "cargo" -args = ["publish"] diff --git a/default-plugins/compact-bar/.cargo/config.toml b/default-plugins/compact-bar/.cargo/config.toml index 6b77899c..6b509f5b 100644 --- a/default-plugins/compact-bar/.cargo/config.toml +++ b/default-plugins/compact-bar/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" +target = "wasm32-wasip1" diff --git a/default-plugins/configuration/.cargo/config.toml b/default-plugins/configuration/.cargo/config.toml index bc255e30..6b509f5b 100644 --- a/default-plugins/configuration/.cargo/config.toml +++ b/default-plugins/configuration/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" \ No newline at end of file +target = "wasm32-wasip1" diff --git a/default-plugins/fixture-plugin-for-tests/.cargo/config.toml b/default-plugins/fixture-plugin-for-tests/.cargo/config.toml index bc255e30..6b509f5b 100644 --- a/default-plugins/fixture-plugin-for-tests/.cargo/config.toml +++ b/default-plugins/fixture-plugin-for-tests/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" \ No newline at end of file +target = "wasm32-wasip1" diff --git a/default-plugins/plugin-manager/.cargo/config.toml b/default-plugins/plugin-manager/.cargo/config.toml index 6b77899c..6b509f5b 100644 --- a/default-plugins/plugin-manager/.cargo/config.toml +++ b/default-plugins/plugin-manager/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" +target = "wasm32-wasip1" diff --git a/default-plugins/session-manager/.cargo/config.toml b/default-plugins/session-manager/.cargo/config.toml index bc255e30..6b509f5b 100644 --- a/default-plugins/session-manager/.cargo/config.toml +++ b/default-plugins/session-manager/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" \ No newline at end of file +target = "wasm32-wasip1" diff --git a/default-plugins/status-bar/.cargo/config.toml b/default-plugins/status-bar/.cargo/config.toml index bc255e30..6b509f5b 100644 --- a/default-plugins/status-bar/.cargo/config.toml +++ b/default-plugins/status-bar/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" \ No newline at end of file +target = "wasm32-wasip1" diff --git a/default-plugins/strider/.cargo/config.toml b/default-plugins/strider/.cargo/config.toml index 6b77899c..6b509f5b 100644 --- a/default-plugins/strider/.cargo/config.toml +++ b/default-plugins/strider/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" +target = "wasm32-wasip1" diff --git a/default-plugins/tab-bar/.cargo/config.toml b/default-plugins/tab-bar/.cargo/config.toml index 6b77899c..6b509f5b 100644 --- a/default-plugins/tab-bar/.cargo/config.toml +++ b/default-plugins/tab-bar/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -target = "wasm32-wasi" +target = "wasm32-wasip1" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d01dbbdb..4864f4e7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,7 @@ # This file is updated by `update-toolchain.sh` [toolchain] # NOTE: When updating this, modify `rust-version` in `Cargo.toml` accordingly -channel = "1.75.0" -components = ["rustfmt", "clippy", "rust-analysis"] -targets = ["wasm32-wasi", "x86_64-unknown-linux-musl"] +channel = "1.84.0" +components = ["rustfmt", "clippy"] +# NOTE: Change this with care, this is also used by the CI pipeline +targets = ["wasm32-wasip1", "x86_64-unknown-linux-musl"] diff --git a/src/tests/fixtures/configs/load_background_plugins.kdl b/src/tests/fixtures/configs/load_background_plugins.kdl index dc270d9f..f3bf4e27 100644 --- a/src/tests/fixtures/configs/load_background_plugins.kdl +++ b/src/tests/fixtures/configs/load_background_plugins.kdl @@ -211,7 +211,7 @@ plugins { } load_plugins { - "file:/usr/src/zellij/wasm32-wasi/release/fixture-plugin-for-tests.wasm" { + "file:/usr/src/zellij/wasm32-wasip1/release/fixture-plugin-for-tests.wasm" { config_key "config_value" config_key2 "config_value2" } diff --git a/xtask/src/build.rs b/xtask/src/build.rs index 67547a1c..4dc17e68 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -127,7 +127,7 @@ fn move_plugin_to_assets(sh: &Shell, plugin_name: &str) -> anyhow::Result<()> { std::env::var_os("CARGO_TARGET_DIR") .unwrap_or(crate::project_root().join("target").into_os_string()), ) - .join("wasm32-wasi") + .join("wasm32-wasip1") .join("release") .join(plugin_name) .with_extension("wasm"); diff --git a/xtask/src/test.rs b/xtask/src/test.rs index 79e5ba6b..9bcfb37a 100644 --- a/xtask/src/test.rs +++ b/xtask/src/test.rs @@ -33,7 +33,7 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> { crate::status(&msg); println!("{}", msg); - // Override wasm32-wasi target for plugins only + // Override wasm32-wasip1 target for plugins only let cmd = if crate_name.contains("plugins") { cmd!(sh, "{cargo} test --target {host_triple} --") } else { @@ -48,7 +48,7 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> { } // Determine the target triple of the host. We explicitly run all tests against the host -// architecture so we can test the plugins, too (they default to wasm32-wasi otherwise). +// architecture so we can test the plugins, too (they default to wasm32-wasip1 otherwise). pub fn host_target_triple(sh: &Shell) -> anyhow::Result { let rustc_ver = cmd!(sh, "rustc -vV") .read() diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index 6096cbd6..5bac0294 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -591,8 +591,6 @@ impl WasmBridge { task::spawn({ let senders = self.senders.clone(); let running_plugin = running_plugin.clone(); - let plugin_id = plugin_id; - let client_id = client_id; let _s = shutdown_sender.clone(); async move { let mut running_plugin = running_plugin.lock().unwrap(); diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index 5a97a442..d4c65755 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -339,7 +339,7 @@ pub fn go_to_previous_tab() { unsafe { host_run_plugin_command() }; } -pub fn report_panic(info: &std::panic::PanicInfo) { +pub fn report_panic(info: &std::panic::PanicHookInfo) { let panic_payload = if let Some(s) = info.payload().downcast_ref::<&str>() { format!("{}", s) } else { diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 3ae60396..8b10a5fe 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -94,7 +94,7 @@ mod not_wasm { // // - `zellij-utils/assets/plugins`: When building in release mode OR when the // `plugins_from_target` feature IS NOT set - // - `zellij-utils/../target/wasm32-wasi/debug`: When building in debug mode AND the + // - `zellij-utils/../target/wasm32-wasip1/debug`: When building in debug mode AND the // `plugins_from_target` feature IS set macro_rules! add_plugin { ($assets:expr, $plugin:literal) => { @@ -110,7 +110,7 @@ mod not_wasm { #[cfg(all(feature = "plugins_from_target", debug_assertions))] include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), - "/../target/wasm32-wasi/debug/", + "/../target/wasm32-wasip1/debug/", $plugin )) .to_vec(), diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index de14de02..8c298357 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -225,8 +225,8 @@ impl FromStr for BareKey { "tab" => Ok(BareKey::Tab), "esc" => Ok(BareKey::Esc), "enter" => Ok(BareKey::Enter), - "capsLock" => Ok(BareKey::CapsLock), - "scrollLock" => Ok(BareKey::ScrollLock), + "capslock" => Ok(BareKey::CapsLock), + "scrolllock" => Ok(BareKey::ScrollLock), "numlock" => Ok(BareKey::NumLock), "printscreen" => Ok(BareKey::PrintScreen), "pause" => Ok(BareKey::Pause), diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs index b159a21e..c15cd44e 100644 --- a/zellij-utils/src/errors.rs +++ b/zellij-utils/src/errors.rs @@ -606,7 +606,7 @@ mod not_wasm { use super::*; use crate::channels::{SenderWithContext, ASYNCOPENCALLS, OPENCALLS}; use miette::{Diagnostic, GraphicalReportHandler, GraphicalTheme, Report}; - use std::panic::PanicInfo; + use std::panic::PanicHookInfo; use thiserror::Error as ThisError; /// The maximum amount of calls an [`ErrorContext`] will keep track @@ -651,7 +651,7 @@ mod not_wasm { } /// Custom panic handler/hook. Prints the [`ErrorContext`]. - pub fn handle_panic(info: &PanicInfo<'_>, sender: &SenderWithContext) + pub fn handle_panic(info: &PanicHookInfo<'_>, sender: &SenderWithContext) where T: ErrorInstruction + Clone, { diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index b4110f73..0201eed4 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -433,7 +433,7 @@ impl RunPlugin { } } -#[derive(Debug, Serialize, Deserialize, Clone, Hash, Default, Eq)] +#[derive(Debug, Serialize, Deserialize, Clone, Default, Eq)] pub struct PluginAlias { pub name: String, pub configuration: Option, @@ -443,10 +443,19 @@ pub struct PluginAlias { impl PartialEq for PluginAlias { fn eq(&self, other: &Self) -> bool { + // NOTE: Keep this in sync with what the `Hash` trait impl does. self.name == other.name && self.configuration == other.configuration } } +impl std::hash::Hash for PluginAlias { + fn hash(&self, state: &mut H) { + // NOTE: Keep this in sync with what the `PartiqlEq` trait impl does. + self.name.hash(state); + self.configuration.hash(state); + } +} + impl PluginAlias { pub fn new( name: &str, diff --git a/zellij-utils/src/pane_size.rs b/zellij-utils/src/pane_size.rs index ba2ac8ed..7de00ee5 100644 --- a/zellij-utils/src/pane_size.rs +++ b/zellij-utils/src/pane_size.rs @@ -10,7 +10,7 @@ use crate::position::Position; /// Contains the position and size of a [`Pane`], or more generally of any terminal, measured /// in character rows and columns. -#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize, Hash)] +#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize)] pub struct PaneGeom { pub x: usize, pub y: usize, @@ -24,6 +24,7 @@ pub struct PaneGeom { impl PartialEq for PaneGeom { fn eq(&self, other: &Self) -> bool { // compare all except is_pinned + // NOTE: Keep this in sync with what the `Hash` trait impl does. self.x == other.x && self.y == other.y && self.rows == other.rows @@ -32,6 +33,17 @@ impl PartialEq for PaneGeom { } } +impl std::hash::Hash for PaneGeom { + fn hash(&self, state: &mut H) { + // NOTE: Keep this in sync with what the `PartiqlEq` trait impl does. + self.x.hash(state); + self.y.hash(state); + self.rows.hash(state); + self.cols.hash(state); + self.is_stacked.hash(state); + } +} + impl Eq for PaneGeom {} #[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]