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

IndexMap build error on yew v0.17.4 #1664

Closed
hube12 opened this issue Dec 16, 2020 · 4 comments · Fixed by #1709
Closed

IndexMap build error on yew v0.17.4 #1664

hube12 opened this issue Dec 16, 2020 · 4 comments · Fixed by #1709
Labels

Comments

@hube12
Copy link

hube12 commented Dec 16, 2020

Compiling yew v0.17.4 from trunk serve give this error

bad status returned from cargo build:    Compiling yew v0.17.4
error[E0107]: wrong number of type arguments: expected 2, found 1
  --> C:\Users\r1\.cargo\registry\src\github.com-1ecc6299db9ec823\yew-0.17.4\src\virtual_dom\mod.rs:69:10
   |
69 |     set: IndexSet<String>,
   |          ^^^^^^^^^^^^^^^^ expected 2 type arguments

error: aborting due to previous error

For more information about this error, try `rustc --explain E0107`.

Steps To Reproduce
Steps to reproduce the behavior:

cargo install trunk ... rust add....
git clone https://github.com/yewstack/yew
cd examples/boids
trunk serve --release

clone the boid web app, install wasm dependencies and trunk, run trunk serve, get error

Expected behavior
Mod.rs should not have that kind of error

@hube12 hube12 added the bug label Dec 16, 2020
@thedodd
Copy link
Contributor

thedodd commented Dec 16, 2020

@hube12 if you build your app outside of trunk using cargo build --release --target wasm32-unknown-unknown do you still get the same error? I ask because technically that is all Trunk does at the end of the day — other than the processing of the non-Rust assets (html, sass, css, &c).

@hube12
Copy link
Author

hube12 commented Dec 16, 2020

@hube12 if you build your app outside of trunk using cargo build --release --target wasm32-unknown-unknown do you still get the same error? I ask because technically that is all Trunk does at the end of the day — other than the processing of the non-Rust assets (html, sass, css, &c).

cargo build --release --target wasm32-unknown-unknown
   Compiling yew v0.17.4
error[E0107]: wrong number of type arguments: expected 2, found 1
  --> C:\Users\r1\.cargo\registry\src\github.com-1ecc6299db9ec823\yew-0.17.4\src\virtual_dom\mod.rs:69:10
   |
69 |     set: IndexSet<String>,
   |          ^^^^^^^^^^^^^^^^ expected 2 type arguments

error: aborting due to previous error

For more information about this error, try `rustc --explain E0107`.
error: could not compile `yew`

To learn more, run the command again with --verbose.

@thedodd
Copy link
Contributor

thedodd commented Dec 16, 2020

@hube12 that's about what I expected. Looks like this doesn't really have anything to do with Trunk :). I hereby yield to the maintainers (@siku2 @jstarry & others).

@siku2
Copy link
Member

siku2 commented Dec 17, 2020

As mentioned on Discord, this error looks like indexmap thinks it's being built without the standard library. In that case IndexMap no longer defaults to the RandomState hasher from std but instead requires a custom one through a type argument, thus the error.
I don't know why it thinks there's no standard library though, there's likely something special about your setup that causes it.

indexmap detects the presence of std in the build script using autocfg::new().emit_sysroot_crate("std") which uses some interesting hacks to detect it (it involves invoking rustc on a small code snippet to see if it compiles). You can look into that to find out more. Try setting the CARGO_FEATURE_STD variable (which is can be used to explicitly set it) to see if this detection is indeed the problem. This requires indexmap 1.6.1 so make sure you have the latest version using cargo update.

@jstarry jstarry changed the title Trunk build error on yew v0.17.4 IndexMap build error on yew v0.17.4 Jan 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants