From 7f6263ceddd6586ef2e65a5cbde5ee6555a43c23 Mon Sep 17 00:00:00 2001 From: Juan Aguilar Santillana Date: Thu, 10 Jan 2019 14:44:35 +0100 Subject: Add warning of deprecated field '_parent' --- askama_derive/src/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'askama_derive/src') diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs index 72d5d20..c23d30f 100644 --- a/askama_derive/src/input.rs +++ b/askama_derive/src/input.rs @@ -4,6 +4,7 @@ use quote::ToTokens; use askama_shared::{Config, Syntax}; +use std::io::{self, Write}; use std::path::PathBuf; use syn; @@ -144,6 +145,15 @@ impl<'a> TemplateInput<'a> { _ => None, }; + if parent.is_some() { + io::stderr() + .write_fmt(format_args!( + " --> in struct {}\n = use of deprecated field '_parent'\n", + ast.ident + )) + .unwrap(); + } + // Validate syntax let syntax = syntax.map_or_else( || config.syntaxes.get(config.default_syntax).unwrap(), -- cgit