diff options
Diffstat (limited to 'askama_parser/src')
-rw-r--r-- | askama_parser/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs index cf105cb..bc29a22 100644 --- a/askama_parser/src/lib.rs +++ b/askama_parser/src/lib.rs @@ -28,9 +28,10 @@ mod _parsed { use super::{Ast, Node, ParseError, Syntax}; pub struct Parsed { + // `source` must outlive `ast`, so `ast` must be declared before `source` + ast: Ast<'static>, #[allow(dead_code)] source: String, - ast: Ast<'static>, } impl Parsed { @@ -44,7 +45,7 @@ mod _parsed { Err(e) => return Err(e), }; - Ok(Self { source, ast }) + Ok(Self { ast, source }) } // The return value's lifetime must be limited to `self` to uphold the unsafe invariant. |