Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change in view macro between 0.6.10 and 0.6.11 #2541

Closed
luxalpa opened this issue Apr 19, 2024 · 0 comments
Closed

Breaking change in view macro between 0.6.10 and 0.6.11 #2541

luxalpa opened this issue Apr 19, 2024 · 0 comments
Labels
bug Something isn't working view macro

Comments

@luxalpa
Copy link
Contributor

luxalpa commented Apr 19, 2024

Describe the bug

The following code used to work in 0.6.10 but it no longer compiles in 0.6.11:

#[component]
pub fn App() -> impl IntoView {
    view! {
        <ContextMenu entries=&vec![1, 2, 3] />
    }
}

#[component]
pub fn ContextMenu<'a>(entries: &'a [i32]) -> impl IntoView {
   todo!()
}

It fails with:

temporary value is freed at the end of this statement
creates a temporary value which is freed while still in use

The issue was introduced in 36b2f91#diff-6f48ef5e16ec5da899bcfd306b73e8399beabcbb88d57ab0b1b33d663b2ec179L193

Basically, the macro used to generate code like this:

{ ::leptos::component_view(&ContextMenu, ::leptos::component_props_builder(&ContextMenu).entries(#[allow(unused_braces)] { &vec![1, 2, 3] }).build()) }

and then changed to this:

let props = ::leptos::component_props_builder(&ContextMenu).entries(#[allow(unused_braces)] {
    &vec![1, 2, 3]
});
#[allow(clippy::let_unit_value, clippy::unit_arg)] let props = props.build();
#[allow(unreachable_code)] ::leptos::component_view(#[allow(clippy::needless_borrows_for_generic_args)] &ContextMenu, props)
@gbj gbj added bug Something isn't working view macro labels Apr 23, 2024
@gbj gbj closed this as completed in 3760ced May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working view macro
Projects
None yet
Development

No branches or pull requests

2 participants