intendednull / yewdux

Ergonomic state management for Yew applications
https://intendednull.github.io/yewdux/
Apache License 2.0
322 stars 31 forks source link

anymap versions < 1.0-beta-X are unsound; the crate seems unmaintained #44

Closed ivmarkov closed 2 years ago

ivmarkov commented 2 years ago

Unfortunately, I cannot hit the issue with your examples, but I hit it every single time with my project (see the 2nd comment for a stacktrace excerpt, which crashes in copy_nonoverlapping). I've also checked that updating anymap to 1.0-beta2 fixes the problem for me - in both yewdux itself as well as in my own yewdux-middleware.

What I would suggest:

ivmarkov commented 2 years ago

Panic stacktrace:

$core::panicking::panic_str_nounwind::h1dcfe20506f0f339 @   ruwm-sim-940091eb10c…d4_bg.wasm:0x699565
$core::intrinsics::copy_nonoverlapping::ha420ec99ae0d0e50   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x2d0985
$<anymap::raw::TypeIdHasher as core::hash::Hasher>::write::h889d2cc619fa67d2    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x3bb757
$core::hash::Hasher::write_u64::h8fb8f95d71a1eeb9   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x553178
$core::hash::impls::<impl core::hash::Hash for u64>::hash::h0d89bf64a7a6ccfb    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x604657
$<core::any::TypeId as core::hash::Hash>::hash::h0a806f6d0df0cd3d   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x63cb6e
$core::hash::impls::<impl core::hash::Hash for &T>::hash::h4d81fb78aed1a4e1 @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6042db
$core::hash::BuildHasher::hash_one::hd2e50c5fb7390eae   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x4f5830
$hashbrown::map::make_insert_hash::h655fc9d0815f2a8f    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x60aae8
$hashbrown::rustc_entry::<impl hashbrown::map::HashMap<K,V,S,A>>::rustc_entry::hf634452ad064ba41    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x1f353e
$std::collections::hash::map::HashMap<K,V,S>::entry::h77103ba90a071b48  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x5c7c6c
$anymap::raw::RawMap<A>::entry::h87c363ec68311a29   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x144040
$anymap::Map<A>::entry::hc7ea8d71801906e9   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x13ee0d
$yewdux::context::get_or_init::{{closure}}::h85eef969945c1cec   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x46a072
$yewdux::mrc::Mrc<T>::with_mut::h076c199873add0cc   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x3cfba7
$yewdux::context::get_or_init::h8ae0736245c0ae85    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x263d77
$yewdux::dispatch::get::hccc99409eb155a23   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x405d1f
$yewdux::functional::use_store::{{closure}}::h9e8ce9ed95ebda1b  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x67d4f4
$yew::functional::hooks::use_state::use_state::{{closure}}::h98ef60dabb68eddf   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6044e8
$yew::functional::hooks::use_reducer::use_reducer_base::{{closure}}::hd55ea2cfea43b803  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x492b00
$yew::functional::hooks::use_hook::{{closure}}::h809a21ba16548bfc   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x1b8ef5
$scoped_tls_hkt::ScopedKeyMut<T>::with::{{closure}}::h0f61c638d7aa5a79  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x58c8b3
$scoped_tls_hkt::ScopedKeyMut<T>::replace::h2fac190fdaafa475    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x42e97b
$scoped_tls_hkt::ScopedKeyMut<T>::with::h911d00abb651e0ee   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x5e23eb
$yew::functional::hooks::use_hook::h6d16201803f43382    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x1e7100
$yew::functional::hooks::use_reducer::use_reducer_base::hddefde4a27ce9247   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6830d6
$yew::functional::hooks::use_reducer::use_reducer::hd2e647c0af36c58c    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6830a8
$yew::functional::hooks::use_state::use_state::h3274815be82f0990    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x46a30d
$yewdux::functional::use_store::hd330b527c6e7cb90   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x2bb02d
$yewdux_middleware::functional::use_store_value::hf341f740d275678a  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x4f50fb
$<hal_sim::ui::pins::pins as yew::functional::FunctionProvider>::run::h8a2a85d0fa565fee @   ruwm-sim-940091eb10c…d4_bg.wasm:0x1b96a8
$<yew::functional::FunctionComponent<T> as yew::html::component::Component>::view::{{closure}}::h42e9e4cea8e700aa   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x5e2517
$scoped_tls_hkt::ScopedKeyMut<T>::set::{{closure}}::h9db54fb015554410   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x63cd9f
$scoped_tls_hkt::ScopedKeyMut<T>::replace::h153184b571856f39    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x40e24b
$scoped_tls_hkt::ScopedKeyMut<T>::set::h7d59cf3ea7db8c01    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x57a1d9
$yew::functional::FunctionComponent<T>::with_hook_state::h485a7174ee0806d3  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x40e725
$<yew::functional::FunctionComponent<T> as yew::html::component::Component>::view::ha1a9e2866c32e708    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x58cc6f
$<yew::html::component::lifecycle::RenderRunner<COMP> as yew::scheduler::Runnable>::run::h294755bdb9e34521  @   ruwm-sim-940091eb10c…ed4_bg.wasm:0xcb89f
$yew::scheduler::start::{{closure}}::h0a1cc86a2e6bcd8b  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x18a27a
$std::thread::local::LocalKey<T>::try_with::h73b98a575ef4ad88   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x397cf9
$std::thread::local::LocalKey<T>::with::h2bb058ea2ee1d056   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x599cb9
$yew::scheduler::start::h62c5fc4899186a43   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6a954a
$yew::html::component::scope::Scope<COMP>::mount_in_place::hd853cb6b47e6c52c    @   ruwm-sim-940091eb10c…ed4_bg.wasm:0xfb3cc
$yew::app_handle::AppHandle<COMP>::mount_with_props::h7bd7d3d63ab8845c  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x3c6f39
$yew::start_app_with_props_in_element::h48305c6fe7032e96    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x615bf3
$yew::start_app_with_props::h50a6e560f19918ff   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x47b44e
$yew::start_app::h262d9806fbc361f7  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6a9565
$ruwm_sim::main::h0cb62367789a0cd5  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x36fae5
$core::ops::function::FnOnce::call_once::ha5a13424c624a4bc  @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6433f6
$std::sys_common::backtrace::__rust_begin_short_backtrace::h117b565122f577ec    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x60797e
$std::rt::lang_start::{{closure}}::h9b0b7e2e2605a5c7    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x59d7ff
$core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h14603894fb0575e4 @   ruwm-sim-940091eb10c…d4_bg.wasm:0x5f0dd0
$std::panicking::try::do_call::h90e08e0a9d2b43cf    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x4dce03
$std::panicking::try::h0aeb0e07606929ad @   ruwm-sim-940091eb10c…d4_bg.wasm:0x375762
$std::panic::catch_unwind::hb5adc59980491268    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x639a4c
$std::rt::lang_start_internal::{{closure}}::h94ca2be8b983219e   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x5aad6b
$std::panicking::try::do_call::h7db84f62bbe4d5d6    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x4dce96
$std::panicking::try::h28677089dff1d706 @   ruwm-sim-940091eb10c…d4_bg.wasm:0x37586a
$std::panic::catch_unwind::hfeff6e2a517cf941    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x639a8b
$std::rt::lang_start_internal::h82623bba765b0c22    @   ruwm-sim-940091eb10c…d4_bg.wasm:0x36f400
$std::rt::lang_start::h6f79665ea84992e9 @   ruwm-sim-940091eb10c…d4_bg.wasm:0x4ff460
$main   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6a63fc
$__wbindgen_start   @   ruwm-sim-940091eb10c…d4_bg.wasm:0x6a9556
finalizeInit    @   ruwm-sim-940091eb10cf1ed4.js:728
init    @   ruwm-sim-940091eb10cf1ed4.js:760
await in init (async)       
(anonymous)
intendednull commented 2 years ago

Nice find! I'll handle the fix. Thanks!

intendednull commented 2 years ago

Updated on master, and 0.8.3 has been released