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

Can not use note as variable in for loop #184

Closed
nicholasday opened this issue Jun 2, 2017 · 3 comments
Closed

Can not use note as variable in for loop #184

nicholasday opened this issue Jun 2, 2017 · 3 comments

Comments

@nicholasday
Copy link

{% for note in notes %} {{ note.id }} {% endfor %}

{% for noter in notes %} {{ noter.id }} {% endfor %}

Both above code snippets result in the following error:

thread '<unnamed>' panicked at 'internal error: entered unreachable code', /home/nicholas/.cargo/registry/src/github.com-1ecc6299db9ec823/tera-0.10.5/src/render.rs:458 note: Run with RUST_BACKTRACE=1 for a backtrace.

I ran it with a backtrace and this is when it panicked:

5: std::panicking::begin_panic at /checkout/src/libstd/panicking.rs:511 6: tera::render::Renderer::render_variable_block

I am using Rocket and seem to have no problems displaying other lists and using for loops with Tera. I can just rename the variable used to something else. But this is such a strange bug, and I thought it warranted an issue.

@Keats
Copy link
Owner

Keats commented Jun 2, 2017

Ah that's a funny one. It finds not which is a Tera keyword in note and stops there. Should be an easy fix.

Thanks for the report!

@Keats
Copy link
Owner

Keats commented Jun 2, 2017

It's fixed in master

@nicholasday
Copy link
Author

nicholasday commented Jun 2, 2017 via email

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

No branches or pull requests

2 participants