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

Incorrect expression hygiene results in cryptic errors #382

Closed
mattfbacon opened this issue Jun 6, 2023 · 0 comments · Fixed by #383
Closed

Incorrect expression hygiene results in cryptic errors #382

mattfbacon opened this issue Jun 6, 2023 · 0 comments · Fixed by #383
Labels

Comments

@mattfbacon
Copy link
Contributor

mattfbacon commented Jun 6, 2023

Consider the following invocation:

html! {
  (1 + 1)
}

This expands to

{
    extern crate alloc;
    extern crate maud;
    let mut __maud_output = alloc::string::String::with_capacity(7usize);
    {
        use ::maud::macro_private::*;
        match ChooseRenderOrDisplay(&1 + 1) { // <- the problem
            x => (&&x)
                .implements_render_or_display()
                .render_to(x.0, &mut __maud_output),
        }
    };
    maud::PreEscaped(__maud_output)
}

Clearly &1 + 1 should have been &(1 + 1).

(Also, the String size hint is wrong.)

@mattfbacon mattfbacon mentioned this issue Jun 6, 2023
lambda-fairy pushed a commit that referenced this issue Jun 11, 2023
* Properly group splice expressions

* Add test for fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants