bazelbuild / bazelbuild/rules_rust
Wasm rust_library produces bad magic number
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
Attempting to use rust_wasm_bindgen to cause a transition results in a wasm file with a bad magic number:
```
error: failed to parse input file as wasm
caused by: Bad magic number (at offset 0)
```
My BUILD:
```python
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
load("@io_bazel_rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")
rust_binary(
name = "example",
edition = "2018",
srcs = [
"src/main.rs",
],
deps = [
"//cargo:wasmer_runtime",
],
data = [":wasm_bindgen_bg.wasm"]
)
rust_wasm_bindgen(
name = "wasm_bindgen",
wasm_file = ":wasm"
)
rust_library(
name = "wasm",
srcs = [
"wasm/src/lib.rs",
],
edition = "2018",
)
```
I invoke bazel using `bazel build //app:example`
Contributor guide
Assessment
This issue has not been assessed yet.