DioxusLabs / DioxusLabs/dioxus
Using `Rc<dyn AnyValue>` as an attribute value causes unreachable code to be hit and panics
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
**Problem**
```
04:09:20 [web] panicked at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dioxus-web-0.7.3/src/mutations.rs:211:18:
internal error: entered unreachable code
Stack:
Error
at http://127.0.0.1:33870/wasm/languna.js:968:25
at logError (http://127.0.0.1:33870/wasm/languna.js:1834:18)
at __wbg_new_00868141024267bc (http://127.0.0.1:33870/wasm/languna.js:967:57)
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[25102]:0x3f2a79
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[14529]:0x383d25
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[3959]:0x244f92
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[19054]:0x3bed22
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[4762]:0x2701f4
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[8443]:0x2ff5bd
at http://127.0.0.1:33870/wasm/languna_bg.wasm:wasm-function[25573]:0x3f419a
```
Line: https://github.com/DioxusLabs/dioxus/blob/d01a820b6f6921ecb6ae459fa85de7bc575a9133/packages/web/src/mutations.rs#L211
Reproducible fragment
```rust
let val = Rc::new(String::new()) as Rc;
rsx! {
iframe { srcdoc: val }
}
```
Originally I wanted to use `Rc` instead of `Rc` but it does not implement `IntoAttributeValue` since `str` is not `Sized`. So that is what lead me to this situation.
It seems the temporary solution is to use a `String` with cloning. For my use case, it is a fairly large `String` but it won't be hit often so it is not too big of a deal.
**Expected behavior**
Works with no panic or compiler error.
**Environment:**
- Dioxus version: v0.7.3
- Rust version: 1.93
- OS info: linux
- App platform: web
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.