djc / askama

Type-safe, compiled Jinja-like templates for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Template compilation infinite loop / failed cycle detection

and-reas-se opened this issue · comments

Hello,

I ran into the same bug as is reported is issue #515. That issue was closed as solved in 2021, with some cycle detection added in, but I have a simple case the cycle detection fails to trigger on.

The following project will reproduce it, running cargo build never halts.

src/lib.rs:

use askama::Template;

#[derive(Template)]
#[template(path = "page.html")]
pub struct Page;

templates/base.html:

{% extends base.html %}

templates/page.html:

{% extends base.html %}

Is page.html necessary to trigger it?

Yes, if you do path = "base.html" in lib.rs the cycle detection triggers properly.

Interesting. Checking what's going on.

Opened #1005. Thanks for the detailed issue! :)