implicit_clone does not play nice with indexmap 2.26
diliop opened this issue · comments
Problem
If yew
's indexmap
dependency is upgraded to 2.2.6
the following error can be seen when building:
error[E0277]: the trait bound `implicit_clone::unsync::IMap<_, _>: From<IndexMap<K, V>>` is not satisfied
--> packages/yew/src/html/conversion/into_prop_value.rs:277:9
|
277 | IMap::from(self)
| ^^^^ the trait `From<IndexMap<K, V>>` is not implemented for `implicit_clone::unsync::IMap<_, _>`
|
= help: the following other types implement trait `From<T>`:
<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>>>>
<implicit_clone::unsync::IMap<K, V> as From<&'static [(K, V)]>>
<implicit_clone::unsync::IMap<K, V> as From<&implicit_clone::unsync::IMap<K, V>>>
I see that From<IndexMap<K, V>>
is implemented here so I'm definitely misunderstanding something. Any pointers appreciated!
Steps To Reproduce
- Update
packages/yew/Cargo.toml
to:
diff --git a/packages/yew/Cargo.toml b/packages/yew/Cargo.toml
index 27c6c545..4dc03941 100644
--- a/packages/yew/Cargo.toml
+++ b/packages/yew/Cargo.toml
@@ -19,7 +19,7 @@ rust-version = "1.64.0"
[dependencies]
console_error_panic_hook = "0.1"
gloo = "0.10"
-indexmap = { version = "2", features = ["std"] }
+indexmap = { version = "2.2.6", features = ["std"] }
js-sys = "0.3"
slab = "0.4"
wasm-bindgen = "0.2"
- Run
cargo build
Expected behavior
cargo build
is successful
Environment:
- Yew version:
master
- Rust version:
1.77.0
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
I get that problem from time to time, executing a cargo update
will fix it. No idea why.
I get that problem from time to time, executing a
cargo update
will fix it. No idea why.
If cargo update
fixes it then the reason for this error is that implicit_clone
's dependency in the lockfile isn't updated when you modify the Cargo.toml. You have to tell cargo to update indexmap
everywhere
Yes, I have a crate that depends on indexmap, it is shared by both frontend and backend. Doing a cargo update
for frontend after cargo update
for backend will prevent the problem.
Thanks for the suggestions, that fixed it!