fix: use annotation method from rust/58052 to fix closure lifetimes

This commit is contained in:
Jonathan Kelley committed 2021-10-30 18:23:28 -04:00
1 parent 9ee2bfb010
commit 27d891934a
15 files changed
+333 -180

No files matched your search

+3 -12
View File
@@ -49,7 +49,7 @@ impl ToTokens for CallBody {
match &self.custom_context {
// The `in cx` pattern allows directly rendering
Some(ident) => out_tokens.append_all(quote! {
#ident.render(dioxus::prelude::LazyNodes::new(move |__cx: NodeFactory|{
#ident.render(dioxus::prelude::LazyNodes::new(move |__cx: NodeFactory| -> VNode {
use dioxus_elements::{GlobalAttributes, SvgAttributes};
#inner
@@ -57,21 +57,12 @@ impl ToTokens for CallBody {
}),
// Otherwise we just build the LazyNode wrapper
None => out_tokens.append_all(quote! {
{
let ___p: Box<dyn FnOnce(NodeFactory) -> VNode + '_> = Box::new(move |__cx: NodeFactory|{
NodeFactory::annotate_lazy(move |__cx: NodeFactory| -> VNode {
use dioxus_elements::{GlobalAttributes, SvgAttributes};
#inner
});
Some(___p)
})
}
// dioxus::prelude::LazyNodes::new(move |__cx: NodeFactory|{
// use dioxus_elements::{GlobalAttributes, SvgAttributes};
// #inner
// })
}),
};
}