Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Building for wasm32-unknown-emscripten fails unless wasm-bindgen version is pinned

未关闭 适合新手
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust, wasm
领域
build-system

调研方向

从 Cargo.toml 开始,并使用 cargo +nightly build --target wasm32-unknown-emscripten 重现失败。阅读 src/queue.rs 中第 24 行和第 79 行附近的 closure 使用情况,然后根据报告的 wasm-bindgen 版本验证依赖解析;当 target 构建成功完成时即表示完成。

由索引模型根据 Issue 内容生成。

描述

cargo +nightly build --target wasm32-unknown-emscripten fails with

error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
   --> src\queue.rs:79:30
    |
 79 |                 Closure::new(move |_| state.run_all())
    |                 ------------ ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferable across a catch_unwind boundary
    |                 |
    |                 required by a bound introduced by this call
    |
    = help: within `QueueState`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`
note: required because it appears within the type `Cell<isize>`
   --> C:\Users\HeartofPhos\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\cell.rs:315:12
    |
315 | pub struct Cell<T: ?Sized> {
    |            ^^^^
note: required because it appears within the type `RefCell<VecDeque<singlethread::Job>>`
   --> C:\Users\HeartofPhos\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\cell.rs:852:12
    |
852 | pub struct RefCell<T: ?Sized> {
    |            ^^^^^^^
note: required because it appears within the type `QueueState`
   --> src\queue.rs:24:8
    |
 24 | struct QueueState {
    |        ^^^^^^^^^^
    = note: required for `Rc<QueueState>` to implement `UnwindSafe`
note: required because `state` is used within this closure
   --> src\queue.rs:79:39
    |
 79 |                 Closure::new(move |_| state.run_all())
    |                                       ^^^^^
    = note: required for `{closure@src\queue.rs:79:30: 79:38}` to implement `wasm_bindgen::__rt::marker::MaybeUnwindSafe`
note: required by a bound in `ScopedClosure::<'static, T>::new`
   --> C:\Users\HeartofPhos\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\wasm-bindgen-0.2.114\src\closure.rs:244:33
    |
242 |     pub fn new<F>(t: F) -> Self
    |            --- required by a bound in this associated function
243 |     where
244 |         F: IntoWasmClosure<T> + MaybeUnwindSafe + 'static,
    |                                 ^^^^^^^^^^^^^^^ required by this bound in `ScopedClosure::<'static, T>::new`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `web-task` (lib) due to 1 previous error

updating Cargo.toml with wasm-bindgen = { version = "=0.2.108", default-features = false } successfully compiles

主要语言
Rust
星标
11
派生
2
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bevyengine/web-task 的其他 Issue

查看 bevyengine/web-task 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。