diff --git a/packages/yew-macro/src/html_tree/html_element.rs b/packages/yew-macro/src/html_tree/html_element.rs index b67c1f53f8c..a501644941b 100644 --- a/packages/yew-macro/src/html_tree/html_element.rs +++ b/packages/yew-macro/src/html_tree/html_element.rs @@ -359,7 +359,7 @@ impl ToTokens for HtmlElement { quote! { ::std::convert::Into::<::yew::virtual_dom::VNode>::into( ::yew::virtual_dom::VTag::__new_other( - #name, + ::yew::virtual_dom::AttrValue::Static(#name), #node_ref, #key, #attributes, @@ -415,7 +415,9 @@ impl ToTokens for HtmlElement { // e.g. html!{<@{"div"}/>} will set `#expr` to `{"div"}` // (note the extra braces). Hence the need for the `allow`. // Anyways to remove the braces? - let mut #vtag_name = ::yew::virtual_dom::AttrValue::from(#expr); + let mut #vtag_name = ::std::convert::Into::< + ::yew::virtual_dom::AttrValue + >::into(#expr); ::std::debug_assert!( #vtag_name.is_ascii(), "a dynamic tag returned a tag name containing non ASCII characters: `{}`", diff --git a/packages/yew-macro/src/html_tree/mod.rs b/packages/yew-macro/src/html_tree/mod.rs index 2474c97b820..266ea31bfd8 100644 --- a/packages/yew-macro/src/html_tree/mod.rs +++ b/packages/yew-macro/src/html_tree/mod.rs @@ -375,9 +375,9 @@ impl ToTokens for HtmlRootBraced { tokens.extend(quote_spanned! {brace.span.span()=> { - ::yew::virtual_dom::VNode::from( + ::yew::virtual_dom::VNode::VList(::std::rc::Rc::new( ::yew::virtual_dom::VList::with_children(#children, ::std::option::Option::None) - ) + )) } }); } diff --git a/packages/yew-macro/tests/html_macro/component-any-children-pass.rs b/packages/yew-macro/tests/html_macro/component-any-children-pass.rs index cf5a924e506..c9b9e0f1777 100644 --- a/packages/yew-macro/tests/html_macro/component-any-children-pass.rs +++ b/packages/yew-macro/tests/html_macro/component-any-children-pass.rs @@ -83,12 +83,12 @@ impl ::std::convert::From<::yew::virtual_dom::VChild> for ChildrenVari impl ::std::convert::Into<::yew::virtual_dom::VNode> for ChildrenVariants { fn into(self) -> ::yew::virtual_dom::VNode { match self { - Self::Child(comp) => ::yew::virtual_dom::VNode::VComp(::std::convert::Into::< + Self::Child(comp) => ::yew::virtual_dom::VNode::VComp(::std::rc::Rc::new(::std::convert::Into::< ::yew::virtual_dom::VComp, - >::into(comp)), - Self::AltChild(comp) => ::yew::virtual_dom::VNode::VComp(::std::convert::Into::< + >::into(comp))), + Self::AltChild(comp) => ::yew::virtual_dom::VNode::VComp(::std::rc::Rc::new(::std::convert::Into::< ::yew::virtual_dom::VComp, - >::into(comp)), + >::into(comp))), } } } diff --git a/packages/yew-macro/tests/html_macro/component-pass.rs b/packages/yew-macro/tests/html_macro/component-pass.rs index 61f0de060f8..f971f66c4cb 100644 --- a/packages/yew-macro/tests/html_macro/component-pass.rs +++ b/packages/yew-macro/tests/html_macro/component-pass.rs @@ -82,12 +82,12 @@ impl ::std::convert::From<::yew::virtual_dom::VChild> for ChildrenVari impl ::std::convert::Into<::yew::virtual_dom::VNode> for ChildrenVariants { fn into(self) -> ::yew::virtual_dom::VNode { match self { - Self::Child(comp) => ::yew::virtual_dom::VNode::VComp(::std::convert::Into::< + Self::Child(comp) => ::yew::virtual_dom::VNode::VComp(::std::rc::Rc::new(::std::convert::Into::< ::yew::virtual_dom::VComp, - >::into(comp)), - Self::AltChild(comp) => ::yew::virtual_dom::VNode::VComp(::std::convert::Into::< + >::into(comp))), + Self::AltChild(comp) => ::yew::virtual_dom::VNode::VComp(::std::rc::Rc::new(::std::convert::Into::< ::yew::virtual_dom::VComp, - >::into(comp)), + >::into(comp))), } } } diff --git a/packages/yew-macro/tests/html_macro/element-fail.stderr b/packages/yew-macro/tests/html_macro/element-fail.stderr index 96f07cac42d..842553fab43 100644 --- a/packages/yew-macro/tests/html_macro/element-fail.stderr +++ b/packages/yew-macro/tests/html_macro/element-fail.stderr @@ -714,3 +714,4 @@ error[E0277]: the trait bound `implicit_clone::unsync::IString: From<{integer}>` >> >> > + = note: required because of the requirements on the impl of `Into` for `{integer}` diff --git a/packages/yew/src/virtual_dom/vtag.rs b/packages/yew/src/virtual_dom/vtag.rs index 632b297f298..60f70c53c14 100644 --- a/packages/yew/src/virtual_dom/vtag.rs +++ b/packages/yew/src/virtual_dom/vtag.rs @@ -239,7 +239,7 @@ impl VTag { #[doc(hidden)] #[allow(clippy::too_many_arguments)] pub fn __new_other( - tag: impl Into, + tag: AttrValue, node_ref: NodeRef, key: Option, // at bottom for more readable macro-expanded coded @@ -248,10 +248,7 @@ impl VTag { children: VNode, ) -> Self { VTag::new_base( - VTagInner::Other { - tag: tag.into(), - children, - }, + VTagInner::Other { tag, children }, node_ref, key, attributes,