From 9d8e55b24ddf5c9b4cf20a30683928ce928a282d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 25 Jul 2018 14:35:20 +0100 Subject: Add comment about subtleties of code generation for includes --- askama_derive/src/generator.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 24370fa..2f6c875 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -537,6 +537,8 @@ impl<'a> Generator<'a> { let src = get_template_source(&path); let nodes = parser::parse(&src); { + // Since nodes must not outlive the Generator, we instantiate + // a nested Generator here to handle the include's nodes. let mut gen = self.child(); gen.handle(ctx, &nodes, buf, AstLevel::Nested); } -- cgit