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

Unnecessary fields required when using blocks for partial rendering #1052

Open
Tortoaster opened this issue May 20, 2024 · 3 comments
Open

Comments

@Tortoaster
Copy link

Given a template like this:

templates/base.html

{% block empty %}
{% endblock %}

{% if let Some(var) = var %}
{{ var }}
{% endif %}

The following code:

#[derive(Template)]
#[template(path = "base.html", block = "empty")]
struct Empty {}

Gives an error:

no field `var` on type `&Empty`

Due to the (empty) match statement generated by the derive macro, even though the field var is not necessary to render just the empty block.

@GuillaumeGomez
Copy link
Contributor

Normally it was fixed in #1029. Please try with the main branch to confirm it was fixed.

@Tortoaster
Copy link
Author

I'm afraid the issue is still there, I tested it on main (c1366e0).

@GuillaumeGomez
Copy link
Contributor

Ok! Gonna take a look in the next hours.

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

Successfully merging a pull request may close this issue.

2 participants