Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/cli-support/src/descriptor.rs:208:15 #3441

Closed
robertpauson opened this issue May 20, 2023 · 5 comments
Labels

Comments

@robertpauson
Copy link

robertpauson commented May 20, 2023

Describe the Bug

trunk build gives off error that was supposed to be fixed. I'm compiling on a Mac. I've tried both versions where people reported it didn't 'yet' happen, as well as the version after it was supposedly fixed. Referring to: https://github.com/rustwasm/wasm-bindgen/issues/2776

Actual Behavior

warning: `eframe_template` (bin "eframe_template") generated 6 warnings (run `cargo fix --bin "eframe_template"` to apply 6 suggestions)
    Finished release [optimized] target(s) in 0.46s
2023-05-20T10:36:58.140267Z  INFO fetching cargo artifacts
2023-05-20T10:36:58.523293Z  INFO processing WASM for eframe_template
2023-05-20T10:36:58.568526Z  INFO calling wasm-bindgen for eframe_template
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/cli-support/src/descriptor.rs:208:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2023-05-20T10:36:58.709588Z ERROR ❌ error

My Cargo.toml (added versions in []):

name = "eframe_template"
version = "0.1.0"
authors = ["Emil Ernerfeldt <[email protected]>"]
edition = "2021"
rust-version = "1.65"
resolver = "2"

[dependencies]

egui.workspace = true ["0.20.1"]
eframe.workspace = true [{ version = "0.20.1", default-features = false, features = [
    "wgpu",
    "persistence"
]}]
egui_extras.workspace = true ["0.20.0"]

chrono.workspace = true ["0.4.22"]
ehttp.workspace = true ["0.2.0"]
ethers.workspace = true ["1.0.1"]
image.workspace = true ["0.24.5"]
regex.workspace = true ["1.7.0"]
serde.workspace = true [{ version = "1", features = ["derive"] }]
serde_json.workspace = true ["1.0.88"]
url.workspace = true ["2.3.1"]
thiserror.workspace = true ["1.0.35"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tracing-subscriber = "0.3"

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
tracing-wasm = "0.2"
wasm-bindgen-futures = "0.4"


[profile.release]
opt-level = 2 # fast and small wasm

# Optimize all dependencies even in debug builds:
[profile.dev.package."*"]
opt-level = 2


[patch.crates-io]

# If you want to use the bleeding edge version of egui and eframe:
# egui = { git = "https://github.com/emilk/egui", branch = "master" }
# eframe = { git = "https://github.com/emilk/egui", branch = "master" }

# If you fork https://github.com/emilk/egui you can test with:
# egui = { path = "../egui/crates/egui" }
# eframe = { path = "../egui/crates/eframe" }

Used to compile

@daxpedda
Copy link
Collaborator

I did try using the latest trunk and wasm-bindgen and it works just fine.

A couple of suggestions:

  • Does cargo update help?
  • Which version of trunk and wasm-bindgen are you using?
  • Did you check if the wasm-bindgen version of your dependency and binary are the same?

@robertpauson
Copy link
Author

robertpauson commented May 20, 2023

  • Does cargo update help?

Same thing happens after cargo update

  • Which version of trunk and wasm-bindgen are you using?

trunk 0.16.0 wasm-bindgen 0.2.86

  • Did you check if the wasm-bindgen version of your dependency and binary are the same?

what do you mean by binary vs dependency?

I also ran cargo install --locked wasm-bindgen-cli but it doesn't change anything

@daxpedda
Copy link
Collaborator

cargo install installs "binaries", you can get the wasm-bindgen binary version by entering this into your terminal:

wasm-bindgen -V

The dependency is what you use in your Rust crate. Look into your Cargo.lock file to determine which version of wasm-binden you are using:

[[package]]
name = "wasm-bindgen"
version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",
]

@robertpauson
Copy link
Author

Thanks. There is conflict:

wasm-bindgen -V

~wasm-bindgen -V

wasm-bindgen 0.2.86

The dependency is what you use in your Rust crate. Look into your Cargo.lock file to determine which version of wasm-binden you are using:

[[package]]
name = "wasm-bindgen"
version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",
]

@robertpauson
Copy link
Author

I have changed the version and it works. Thanks for fast response=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants