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

implicit_clone does not play nice with indexmap 2.26 #3655

Closed
1 of 3 tasks
diliop opened this issue Apr 27, 2024 · 4 comments
Closed
1 of 3 tasks

implicit_clone does not play nice with indexmap 2.26 #3655

diliop opened this issue Apr 27, 2024 · 4 comments
Labels

Comments

@diliop
Copy link

diliop commented Apr 27, 2024

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

  1. 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"
  1. 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
@diliop diliop added the bug label Apr 27, 2024
@deftsp
Copy link
Contributor

deftsp commented Apr 28, 2024

I get that problem from time to time, executing a cargo update will fix it. No idea why.

@hamza1311
Copy link
Member

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

@deftsp
Copy link
Contributor

deftsp commented Apr 29, 2024

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.

@diliop
Copy link
Author

diliop commented Apr 29, 2024

Thanks for the suggestions, that fixed it!

@diliop diliop closed this as completed Apr 29, 2024
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

3 participants