dioxus
dioxus copied to clipboard
rsx macro fails to parse with confusing error message: missing trailing comma
Problem rsx macro fails to parse with confusing error message
Steps To Reproduce This code
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx!(
div { class: "game",
div { class: "board", board }
div { class: "state", game.with(|g| g.state().to_string()), }
}
)
}
produces this error when running dx serve:
\ ⚙️ Compiling dioxus 0.5.1 (registry+https://github.com/rust-lang/crates.io-index) error: missing trailing comma
--> src/main.rs:11:35
|
11 | div { class: "state", game.with(|g| g.state().to_string()), }
| ^^^^
error: could not compile `test-dioxus-web-rsx` (bin "test-dioxus-web-rsx") due to 1 previous error
Error: 🚫 Serving project failed:
Caused by:
Build failed
Environment:
- Dioxus version: 0.5.1
- Rust version: 1.76.0
- OS info: Linux
- App platform: web
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
The errors need to be better here but expressions must be wrapped in curly braces.
Thanks, that is very helpful. I am porting from 0.4 and trying to follow the migration guides, but I don't recall seeing this information.
Anyway, that seems to have been the missing piece for me to complete my migration. Thanks again!