Open johansmitsnl opened 3 years ago
With maud
's html!
macro, the error goes away if you change the braces to square or parens. Is the same true for yew
?
For me using html![]
or html!()
seems to work, but fails in a different way. It then detects the code as unreachable.
This is still happening on nightly. Switching to []
fixes the issue for me, but why does it fail with html!{}
?
We switched to Yew 0.19 a while back. That actually "solved" the issue.
FWIW, I'm on nightly yew and nightly rust plugin and this is still broken.
nightly yew
Yew does not have a nightly release. You may want to clarify what you're referring to
@hamza1311 the master branch: yew = { git = "https://github.com/yewstack/yew/" }
@johansmitsnl @Waridley @ctron @bit-void do you still experience this problem? If yes, could you please provide minimal example? I can't reproduce it with 0.4.176.4762-221-nightly
and yew = { git = "https://github.com/yewstack/yew/" }
:
No, I haven't seen this in a while. IIRC there was a significant improvement when migrating from Yew 0.17 to 0.19 (not sure about 0.18). I guess this improved something, which made it work better with the Rust plugin. It is ok to close from my point of view.
@dima74 I have not used yew projects lately so I can't give feedback on it. But @ctron does not experiencing it you can close it if you like.
Hi, I just encountered this issue, the project is very minimal, only containing Cargo.toml
and src/main.rs
main.rs
use yew::prelude::*;
fn main() {
yew::start_app::<App>();
}
#[function_component(App)]
pub fn app() -> Html {
html! {
<div>
<h2 class={"heading"}>{"Hello, World!"}</h2>
</div>
}
}
Cargo.toml
[package]
name = "yew-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
yew = "0.19.3"
Interestingly if I replace the html! {}
with html! ()
or html! []
the error disappears.
I tried setting toolchain to nightly, but that didn't work.
@YthanZhang could you please try to enable org.rust.cargo.evaluate.build.scripts
and org.rust.macros.proc
experimental features
@dima74 Enabling org.rust.cargo.evaluate.build.scripts
fixed the issue. Enabling org.rust.macros.proc
didn't seem to affect this issue.
org.rust.cargo.evaluate.build.scripts
fixes the issue the component warning to be lowercase. In the #[component]
they have added this ignore message.
org.rust.macros.proc
fixes the issue that i says the wrong return type the initial error from this issue:
With both options enabled it is now happy :+1:
Hope this helps.
Both experimental features enabled and I still see this issue. However changing to [] from {} resolves. The totality of the app is as follows:
use yew::prelude::*;
struct App {}
impl Component for App {
type Message = ();
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
todo!()
}
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {}
}
}
fn main() {
yew::start_app::<App>();
}
Both experimental features enabled and I still see this issue. However changing to [] from {} resolves
@bradvoth This is very strange. Is the error with {}
consistently reproducible? Please try to invalidate caches. Also could you please attach your idea.log
and specify what version of yew
are you using
Environment
Problem description
When wrapping the html in the match it gives this markup error but it works fine. Also the compiler thinks it is ok.
Steps to reproduce
Wrap a view in a match case like this: