diff options
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/generator.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 6004aff..df15bdc 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -916,7 +916,14 @@ impl<'a> Generator<'a> { }; let mut expr_buf = Buffer::new(0); + let borrow_val = !is_copyable(val); + if borrow_val { + expr_buf.write("&("); + } self.visit_expr(&mut expr_buf, val)?; + if borrow_val { + expr_buf.write(")"); + } let shadowed = self.is_shadowing_variable(&l.var)?; if shadowed { |