From 4327f1e5de9dd054cb2e431914a5bcdbe46c298a Mon Sep 17 00:00:00 2001 From: Mendy Berger <12537668+MendyBerger@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:33:15 -0500 Subject: [PATCH 1/2] Emphasize borrowing rule in C docs Missing this "not" wasted an hour of my time :sweat_smile: --- crates/c/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/c/README.md b/crates/c/README.md index c0a9772f7..522f90e8b 100644 --- a/crates/c/README.md +++ b/crates/c/README.md @@ -479,7 +479,7 @@ The importing component's responsibility for dropping borrows of imported resour - If the borrow was passed as an argument to one of the importing component's exports: - If the bindings were generated with `--autodrop-borrows=yes`, then borrowed handles will be automatically dropped when the exported function returns; no additional action is required by importing component - If the bindings were generated with `--autodrop-borrow=no`, or this command line option was not supplied, then the importing component must drop the borrowed handle by calling the generated `*_drop_borrow` function. -- If the component obtained the borrow by calling `*_borrow*_` on an owned resource, it must not call `*_drop_borrow` +- If the component obtained the borrow by calling `*_borrow*_` on an owned resource, it must **not** call `*_drop_borrow` Here is a potential implementation of the `run` export that correctly handles the lifetime of the owned cat resource retrieved from `get-cat-by-name`: From 86c64c1af3d62975b97be1cf7c4b5a2376871a7b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 17 Nov 2025 14:54:18 -0800 Subject: [PATCH 2/2] Use a pinned nightly --- .github/workflows/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c42dd3af4..29d22b10e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -147,10 +147,11 @@ jobs: - run: cargo test -p wit-bindgen --all-features - run: cargo test -p wit-bindgen-rust - run: cargo test --workspace --exclude 'wit-bindgen*' - - run: rustup update nightly --no-self-update - - run: rustup component add miri --toolchain nightly - - run: rustup component add rust-src --toolchain nightly - - run: cargo +nightly miri test -p wit-bindgen --all-features + - run: rustup update nightly-2025-11-10 --no-self-update + - run: rustup default nightly-2025-11-10 + - run: rustup component add miri + - run: rustup component add rust-src + - run: cargo miri test -p wit-bindgen --all-features check: name: Check