yewstack / yew

Rust / Wasm framework for creating reliable and efficient web applications

Home Page:https://yew.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yew does not compile

etiennecollin opened this issue · comments

Problem
Rustc cannot compile yew 0.20.0.

Steps To Reproduce
Try to compile a project which has yew 0.20.0 as a dependency.

Expected behavior
Yew should compile. I tried to regenerate my cargo registry (~/.cargo/registry), but the issue persisted.

Terminal Output of cargo rustc

	Compiling yew v0.20.0
error[E0277]: the trait bound `implicit_clone::unsync::IMap<_, _>: From<indexmap::IndexMap<K, V>>` is not satisfied
   --> /Users/etiennecollin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/yew-0.20.0/src/html/conversion.rs:204:20
    |
204 |         IMap::from(self)
    |         ---------- ^^^^ the trait `From<indexmap::IndexMap<K, V>>` is not implemented for `implicit_clone::unsync::IMap<_, _>`
    |         |
    |         required by a bound introduced by this call
    |
    = help: the following other types implement trait `From<T>`:
              <implicit_clone::unsync::IMap<K, V> as From<&'static [(K, V)]>>
              <implicit_clone::unsync::IMap<K, V> as From<indexmap::map::IndexMap<K, V>>>
              <implicit_clone::unsync::IMap<K, V> as From<std::rc::Rc<indexmap::map::IndexMap<K, V>>>>

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

Environment:

  • Yew version: 0.20.0
  • Rust version: 1.71.0

Here is the output to cargo --version --verbose:

> cargo --version --verbose
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
release: 1.71.0
commit-hash: cfd3bbd8fe4fd92074dfad04b7eb9a923646839f
commit-date: 2023-06-08
host: aarch64-apple-darwin
libgit2: 1.6.4 (sys:0.17.1 vendored)
libcurl: 7.88.1 (sys:0.4.61+curl-8.0.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1t  7 Feb 2023
os: Mac OS 13.4.1 [64-bit]

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

This is due to an upstream dependency (implicit-clone) introduced a major version update of a dependency (indexmap) which is making it to be incompatible with Yew v0.20.

Until the upstream is fixed, you can use the following workaround by pinning implicit-clone to v0.3.6.

[dependencies]
implicit-clone = "=0.3.6" 

implicit-clone v0.3.8 is yanked from the registry.

You should now be able to remove the workaround and run cargo update and that should fix this issue.
Feel free to reopen the issue if it still doesn't work for you.

The issue is fixed! Thank you!