diff --git a/rinja_derive/Cargo.toml b/rinja_derive/Cargo.toml index 9e14897b8..a51606970 100644 --- a/rinja_derive/Cargo.toml +++ b/rinja_derive/Cargo.toml @@ -26,6 +26,7 @@ with-warp = [] [dependencies] parser = { package = "rinja_parser", version = "0.2.0", path = "../rinja_parser" } +annotate-snippets = "0.11.4" basic-toml = { version = "0.1.1", optional = true } memchr = "2" mime = "0.3" diff --git a/rinja_derive/src/lib.rs b/rinja_derive/src/lib.rs index 6788a8df3..5946515c9 100644 --- a/rinja_derive/src/lib.rs +++ b/rinja_derive/src/lib.rs @@ -14,6 +14,7 @@ use std::collections::HashMap; use std::fmt; use std::path::Path; +use annotate_snippets::{Level, Renderer, Snippet}; use config::{read_config_file, Config}; use generator::{Generator, MapChain}; use heritage::{Context, Heritage}; @@ -96,8 +97,14 @@ pub fn derive_template(input: TokenStream12) -> TokenStream12 { Err(CompileError { msg, span, - rendered: _rendered, + rendered, }) => { + let msg = if rendered { + eprintln!("{msg}"); + "the previous template error derives from" + } else { + &msg + }; let mut ts: TokenStream = parse_quote_spanned! { span.unwrap_or(ast.ident.span()) => ::core::compile_error!(#msg); @@ -227,6 +234,38 @@ impl CompileError { file_info: Option>, span: Option, ) -> Self { + if let Some(FileInfo { + path, + source: Some(source), + node_source: Some(node_source), + }) = file_info + { + if source + .as_bytes() + .as_ptr_range() + .contains(&node_source.as_ptr()) + { + let label = msg.to_string(); + let path = match std::env::current_dir() { + Ok(cwd) => strip_common(&cwd, path), + Err(_) => path.display().to_string(), + }; + + let start = node_source.as_ptr() as usize - source.as_ptr() as usize; + let annotation = Level::Error.span(start..start).label("close to this token"); + let snippet = Snippet::source(source) + .origin(&path) + .fold(true) + .annotation(annotation); + let message = Level::Error.title(&label).snippet(snippet); + return Self { + msg: Renderer::styled().render(message).to_string(), + span, + rendered: true, + }; + } + } + let msg = match file_info { Some(file_info) => format!("{msg}{file_info}"), None => msg.to_string(), diff --git a/rinja_derive_standalone/Cargo.toml b/rinja_derive_standalone/Cargo.toml index 657daa617..4a1c4a3ba 100644 --- a/rinja_derive_standalone/Cargo.toml +++ b/rinja_derive_standalone/Cargo.toml @@ -25,6 +25,7 @@ with-warp = [] [dependencies] parser = { package = "rinja_parser", version = "0.2.0", path = "../rinja_parser" } +annotate-snippets = "0.11.4" basic-toml = { version = "0.1.1", optional = true } memchr = "2" mime = "0.3" diff --git a/testing/tests/ui/as-primitive-type.stderr b/testing/tests/ui/as-primitive-type.stderr index 86dba2305..2aaaa0e61 100644 --- a/testing/tests/ui/as-primitive-type.stderr +++ b/testing/tests/ui/as-primitive-type.stderr @@ -1,46 +1,34 @@ -error: `as` operator expects the name of a primitive type on its right-hand side - --> :1:8 - "as 4567 }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:4:21 | 4 | #[template(source = r#"{{ 1234 as 4567 }}"#, ext = "html")] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: `as` operator expects the name of a primitive type on its right-hand side - --> :1:8 - "as ? }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:8:21 | 8 | #[template(source = r#"{{ 1234 as ? }}"#, ext = "html")] | ^^^^^^^^^^^^^^^^^^^^ -error: `as` operator expects the name of a primitive type on its right-hand side, found `u1234` - --> :1:8 - "as u1234 }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:12:21 | 12 | #[template(source = r#"{{ 1234 as u1234 }}"#, ext = "html")] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: `as` operator expects the name of a primitive type on its right-hand side, found `core` - --> :1:8 - "as core::primitive::u32 }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:16:21 | 16 | #[template(source = r#"{{ 1234 as core::primitive::u32 }}"#, ext = "html")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `as` operator expects the name of a primitive type on its right-hand side, found `int32_t` - --> :1:8 - "as int32_t }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:20:21 | 20 | #[template(source = r#"{{ 1234 as int32_t }}"#, ext = "html")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `as` operator expects the name of a primitive type on its right-hand side, found `int32_t` - --> :1:35 - "as int32_t }}" +error: the previous template error derives from --> tests/ui/as-primitive-type.rs:24:21 | 24 | #[template(source = r#"{{ (1234 + 4 * 12 / 45675445 - 13) as int32_t }}"#, ext = "html")] diff --git a/testing/tests/ui/block_in_filter_block.stderr b/testing/tests/ui/block_in_filter_block.stderr index 89974337a..8f3cff00c 100644 --- a/testing/tests/ui/block_in_filter_block.stderr +++ b/testing/tests/ui/block_in_filter_block.stderr @@ -1,6 +1,4 @@ -error: cannot have a block inside a filter block - --> BlockInFilter.html:7:10 - " block title %}New title{% endblock %}\n a b\n {% endfilter %}\n{%- endblock body %}\n" +error: the previous template error derives from --> tests/ui/block_in_filter_block.rs:5:14 | 5 | source = r#"{% extends "html-base.html" %} diff --git a/testing/tests/ui/blocks_below_top_level.stderr b/testing/tests/ui/blocks_below_top_level.stderr index 653998a08..256f0fe8a 100644 --- a/testing/tests/ui/blocks_below_top_level.stderr +++ b/testing/tests/ui/blocks_below_top_level.stderr @@ -1,6 +1,4 @@ -error: `extends` blocks are not allowed below top level - --> MyTemplate1.txt:3:2 - " extends \"bla.txt\" %}\n{% endblock %}\n" +error: the previous template error derives from --> tests/ui/blocks_below_top_level.rs:4:21 | 4 | #[template(source = r#" @@ -11,9 +9,7 @@ error: `extends` blocks are not allowed below top level 8 | | "#, ext = "txt")] | |__^ -error: `macro` blocks are not allowed below top level - --> MyTemplate2.txt:3:2 - " macro bla() %}\n{% endmacro %}\n{% endblock %}\n" +error: the previous template error derives from --> tests/ui/blocks_below_top_level.rs:12:21 | 12 | #[template(source = r#" @@ -25,9 +21,7 @@ error: `macro` blocks are not allowed below top level 17 | | "#, ext = "txt")] | |__^ -error: `import` blocks are not allowed below top level - --> MyTemplate3.txt:3:2 - " import \"bla.txt\" as blue %}\n{% endblock %}\n" +error: the previous template error derives from --> tests/ui/blocks_below_top_level.rs:21:21 | 21 | #[template(source = r#" diff --git a/testing/tests/ui/break_outside_of_loop.stderr b/testing/tests/ui/break_outside_of_loop.stderr index ba23ec45f..ca744e27b 100644 --- a/testing/tests/ui/break_outside_of_loop.stderr +++ b/testing/tests/ui/break_outside_of_loop.stderr @@ -1,6 +1,4 @@ -error: you can only `break` inside a `for` loop - --> :1:9 - "break%}, have a parsing error!" +error: the previous template error derives from --> tests/ui/break_outside_of_loop.rs:5:14 | 5 | source = "Have a {%break%}, have a parsing error!", diff --git a/testing/tests/ui/char_literal.stderr b/testing/tests/ui/char_literal.stderr index 5a116fc2d..b32c668a0 100644 --- a/testing/tests/ui/char_literal.stderr +++ b/testing/tests/ui/char_literal.stderr @@ -1,62 +1,46 @@ -error: invalid character - --> testing/templates/char-literals/char-literal-1.txt:1:11 - "'\\a' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:4:19 | 4 | #[template(path = "char-literals/char-literal-1.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid character - --> testing/templates/char-literals/char-literal-2.txt:1:11 - "'\\x' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:8:19 | 8 | #[template(path = "char-literals/char-literal-2.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid character - --> testing/templates/char-literals/char-literal-3.txt:1:11 - "'\\x1' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:12:19 | 12 | #[template(path = "char-literals/char-literal-3.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: must be a character in the range [\x00-\x7f] - --> testing/templates/char-literals/char-literal-4.txt:1:11 - "'\\x80' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:16:19 | 16 | #[template(path = "char-literals/char-literal-4.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid character - --> testing/templates/char-literals/char-literal-5.txt:1:11 - "'\\u' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:20:19 | 20 | #[template(path = "char-literals/char-literal-5.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid character - --> testing/templates/char-literals/char-literal-6.txt:1:11 - "'\\u{}' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:24:19 | 24 | #[template(path = "char-literals/char-literal-6.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: unicode escape must be at most 10FFFF - --> testing/templates/char-literals/char-literal-7.txt:1:11 - "'\\u{110000}' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:28:19 | 28 | #[template(path = "char-literals/char-literal-7.txt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid character - --> :1:11 - "'aaa' %}" +error: the previous template error derives from --> tests/ui/char_literal.rs:32:21 | 32 | #[template(source = "{% let s = 'aaa' %}", ext = "html")] diff --git a/testing/tests/ui/error_file_path.stderr b/testing/tests/ui/error_file_path.stderr index 36facafd7..07f8936f1 100644 --- a/testing/tests/ui/error_file_path.stderr +++ b/testing/tests/ui/error_file_path.stderr @@ -1,22 +1,16 @@ -error: failed to parse template source - --> testing/templates/invalid_syntax.html:1:14 - "}" +error: the previous template error derives from --> tests/ui/error_file_path.rs:4:19 | 4 | #[template(path = "invalid_syntax.html")] | ^^^^^^^^^^^^^^^^^^^^^ -error: failed to parse template source - --> testing/templates/invalid_syntax.html:1:14 - "}" +error: the previous template error derives from --> tests/ui/error_file_path.rs:8:19 | 8 | #[template(path = "include_invalid_syntax.html")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: failed to parse template source - --> testing/templates/invalid_syntax.html:1:14 - "}" +error: the previous template error derives from --> tests/ui/error_file_path.rs:12:21 | 12 | #[template(source = r#"{% extends "include_invalid_syntax.html" %}"#, ext = "txt")] diff --git a/testing/tests/ui/excessive_nesting.stderr b/testing/tests/ui/excessive_nesting.stderr index 0fa8ebdef..ba98d6770 100644 --- a/testing/tests/ui/excessive_nesting.stderr +++ b/testing/tests/ui/excessive_nesting.stderr @@ -1,6 +1,4 @@ -error: your template code is too deeply nested, or last expression is too complex - --> :14:42 - "%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 200\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 300\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 400\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 500\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 600\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 700\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 800\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 900\n\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}\n {%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%}{%if 1%} 1000\n " +error: the previous template error derives from --> tests/ui/excessive_nesting.rs:5:14 | 5 | source = " diff --git a/testing/tests/ui/extends.stderr b/testing/tests/ui/extends.stderr index 71274cbbd..c67350c87 100644 --- a/testing/tests/ui/extends.stderr +++ b/testing/tests/ui/extends.stderr @@ -1,14 +1,10 @@ -error: whitespace control is not allowed on `extends` - --> :1:2 - "- extends \"whatever.html\" %}" +error: the previous template error derives from --> tests/ui/extends.rs:5:14 | 5 | source = r#"{%- extends "whatever.html" %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: whitespace control is not allowed on `extends` - --> :1:2 - " extends \"whatever.html\" -%}" +error: the previous template error derives from --> tests/ui/extends.rs:12:14 | 12 | source = r#"{% extends "whatever.html" -%}"#, diff --git a/testing/tests/ui/filter-recursion.stderr b/testing/tests/ui/filter-recursion.stderr index 581b41642..4cf963ddc 100644 --- a/testing/tests/ui/filter-recursion.stderr +++ b/testing/tests/ui/filter-recursion.stderr @@ -1,6 +1,4 @@ -error: your template code is too deeply nested, or last expression is too complex - --> testing/templates/filter-recursion.html:1:255 - "|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A||A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A" +error: the previous template error derives from --> tests/ui/filter-recursion.rs:4:19 | 4 | #[template(path = "filter-recursion.html")] diff --git a/testing/tests/ui/filter_block_ws.stderr b/testing/tests/ui/filter_block_ws.stderr index f94c121b2..c1cee273b 100644 --- a/testing/tests/ui/filter_block_ws.stderr +++ b/testing/tests/ui/filter_block_ws.stderr @@ -1,6 +1,4 @@ -error: failed to parse template source - --> :1:27 - " %}\nHELLO\n{{v}}\n{%- endfilter %}" +error: the previous template error derives from --> tests/ui/filter_block_ws.rs:4:21 | 4 | #[template(source = "{% filter lower|indent(2) - %} diff --git a/testing/tests/ui/include-a-folder.stderr b/testing/tests/ui/include-a-folder.stderr index 08a1cef84..bb3cc54d5 100644 --- a/testing/tests/ui/include-a-folder.stderr +++ b/testing/tests/ui/include-a-folder.stderr @@ -1,6 +1,4 @@ -error: unable to open template file '$WORKSPACE/target/tests/trybuild/rinja_testing/templates/a_file_that_is_actually_a_folder.html': Is a directory (os error 21) - --> YouCannotIncludeFolders.txt:1:2 - " include \"a_file_that_is_actually_a_folder.html\" %}" +error: the previous template error derives from --> tests/ui/include-a-folder.rs:4:34 | 4 | #[template(ext = "txt", source = r#"{% include "a_file_that_is_actually_a_folder.html" %}"#)] diff --git a/testing/tests/ui/is_defined.stderr b/testing/tests/ui/is_defined.stderr index 3849fde89..6511c8a07 100644 --- a/testing/tests/ui/is_defined.stderr +++ b/testing/tests/ui/is_defined.stderr @@ -1,46 +1,34 @@ -error: `is defined` operator can only be used on variables, not on their fields - --> :1:6 - "x.y is defined %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:6:14 | 6 | source = r#"{% if x.y is defined %}{% endif %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `is defined` operator can only be used on variables - --> :1:6 - "true is defined %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:13:14 | 13 | source = r#"{% if true is defined %}{% endif %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: expected `defined` or `not defined` after `is` - --> :1:6 - "true is %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:20:14 | 20 | source = r#"{% if true is %}{% endif %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: expected `defined` or `not defined` after `is` - --> :1:6 - "x is %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:27:14 | 27 | source = r#"{% if x is %}{% endif %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: expected `defined` or `not defined` after `is` - --> :1:6 - "x is blue %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:34:14 | 34 | source = r#"{% if x is blue %}{% endif %}"#, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: expected `defined` or `not defined` after `is` - --> :1:6 - "x is blue.red %}{% endif %}" +error: the previous template error derives from --> tests/ui/is_defined.rs:41:14 | 41 | source = r#"{% if x is blue.red %}{% endif %}"#, diff --git a/testing/tests/ui/iso646.stderr b/testing/tests/ui/iso646.stderr index 57fd27970..f8dd7ad18 100644 --- a/testing/tests/ui/iso646.stderr +++ b/testing/tests/ui/iso646.stderr @@ -1,23 +1,16 @@ -error: the binary AND operator is called `bitand` in rinja - --> :1:6 - " b }}" +error: the previous template error derives from --> tests/ui/iso646.rs:4:34 | 4 | #[template(ext = "txt", source = "{{ a & b }}")] | ^^^^^^^^^^^^^ -error: the filter operator `|` must not be preceded by any whitespace characters - the binary OR operator is called `bitor` in rinja - --> :1:4 - " | b }}" +error: the previous template error derives from --> tests/ui/iso646.rs:18:34 | 18 | #[template(ext = "txt", source = "{{ a | b }}")] | ^^^^^^^^^^^^^ -error: the binary XOR operator is called `xor` in rinja - --> :1:6 - " b }}" +error: the previous template error derives from --> tests/ui/iso646.rs:32:34 | 32 | #[template(ext = "txt", source = "{{ a ^ b }}")] diff --git a/testing/tests/ui/json-too-many-args.stderr b/testing/tests/ui/json-too-many-args.stderr index c2e59678c..15d6fb2b6 100644 --- a/testing/tests/ui/json-too-many-args.stderr +++ b/testing/tests/ui/json-too-many-args.stderr @@ -1,6 +1,4 @@ -error: unexpected argument(s) in `json` filter - --> OneTwoThree.txt:1:3 - "1|json(2, 3) }}" +error: the previous template error derives from --> tests/ui/json-too-many-args.rs:6:34 | 6 | #[template(ext = "txt", source = "{{ 1|json(2, 3) }}")] diff --git a/testing/tests/ui/let_destructuring_has_rest.stderr b/testing/tests/ui/let_destructuring_has_rest.stderr index 61eb6efd6..68fb59707 100644 --- a/testing/tests/ui/let_destructuring_has_rest.stderr +++ b/testing/tests/ui/let_destructuring_has_rest.stderr @@ -1,7 +1,4 @@ -error: unexpected `,` character after `..` - note that in a named struct, `..` must come last to ignore other members - --> :2:20 - ", } = x -%}hello {{ a }}{%- endif -%}\n" +error: the previous template error derives from --> tests/ui/let_destructuring_has_rest.rs:9:21 | 9 | #[template(source = " @@ -10,9 +7,7 @@ error: unexpected `,` character after `..` 11 | | ", ext = "html")] | |_^ -error: expected `,` for more members, or `}` as terminator - --> :2:17 - ".. } = x -%}hello {{ a }}{%- endif -%}\n" +error: the previous template error derives from --> tests/ui/let_destructuring_has_rest.rs:17:21 | 17 | #[template(source = " @@ -21,9 +16,7 @@ error: expected `,` for more members, or `}` as terminator 19 | | ", ext = "html")] | |_^ -error: expected member, or `}` as terminator - --> :2:18 - "1 } = x -%}hello {{ a }}{%- endif -%}\n" +error: the previous template error derives from --> tests/ui/let_destructuring_has_rest.rs:25:21 | 25 | #[template(source = " @@ -32,10 +25,7 @@ error: expected member, or `}` as terminator 27 | | ", ext = "html")] | |_^ -error: unexpected `,` character after `..` - note that in a named struct, `..` must come last to ignore other members - --> :2:20 - ", b } = x -%}hello {{ a }}{%- endif -%}\n" +error: the previous template error derives from --> tests/ui/let_destructuring_has_rest.rs:33:21 | 33 | #[template(source = " @@ -44,10 +34,7 @@ error: unexpected `,` character after `..` 35 | | ", ext = "html")] | |_^ -error: unexpected `,` character after `..` - note that in a named struct, `..` must come last to ignore other members - --> :2:17 - ", b } = x -%}hello {{ a }}{%- endif -%}\n" +error: the previous template error derives from --> tests/ui/let_destructuring_has_rest.rs:41:21 | 41 | #[template(source = " diff --git a/testing/tests/ui/lit_on_assignment_lhs.stderr b/testing/tests/ui/lit_on_assignment_lhs.stderr index b49b22265..d1f4ddd25 100644 --- a/testing/tests/ui/lit_on_assignment_lhs.stderr +++ b/testing/tests/ui/lit_on_assignment_lhs.stderr @@ -1,6 +1,4 @@ -error: literals are not allowed on the left-hand side of an assignment - --> MyTemplate.txt:1:2 - "let 7=x%}" +error: the previous template error derives from --> tests/ui/lit_on_assignment_lhs.rs:5:14 | 5 | source = "{%let 7=x%}", diff --git a/testing/tests/ui/loop_cycle_empty.stderr b/testing/tests/ui/loop_cycle_empty.stderr index fd5335216..b36ac1f9b 100644 --- a/testing/tests/ui/loop_cycle_empty.stderr +++ b/testing/tests/ui/loop_cycle_empty.stderr @@ -1,6 +1,4 @@ -error: loop.cycle(…) cannot use an empty array - --> ForCycleEmpty.txt:1:35 - "[]) }}{{ v }},{% endfor %}" +error: the previous template error derives from --> tests/ui/loop_cycle_empty.rs:5:14 | 5 | source = r#"{% for v in values %}{{ loop.cycle([]) }}{{ v }},{% endfor %}"#, diff --git a/testing/tests/ui/loop_cycle_wrong_argument_count.stderr b/testing/tests/ui/loop_cycle_wrong_argument_count.stderr index 27b489cfc..16fd4b224 100644 --- a/testing/tests/ui/loop_cycle_wrong_argument_count.stderr +++ b/testing/tests/ui/loop_cycle_wrong_argument_count.stderr @@ -1,6 +1,4 @@ -error: loop.cycle(…) cannot use an empty array - --> ForCycle.txt:1:28 - ".cycle(\"r\", \"g\", \"b\") }}{{ v }},{% endfor %}" +error: the previous template error derives from --> tests/ui/loop_cycle_wrong_argument_count.rs:5:14 | 5 | source = r#"{% for v in values %}{{ loop.cycle("r", "g", "b") }}{{ v }},{% endfor %}"#, diff --git a/testing/tests/ui/macro-super.stderr b/testing/tests/ui/macro-super.stderr index c03acad59..8f35737ca 100644 --- a/testing/tests/ui/macro-super.stderr +++ b/testing/tests/ui/macro-super.stderr @@ -1,6 +1,4 @@ -error: 'super' is not a valid name for a macro - --> :1:2 - "- macro super() -%}{%- endmacro -%}" +error: the previous template error derives from --> tests/ui/macro-super.rs:4:21 | 4 | #[template(source = "{%- macro super() -%}{%- endmacro -%}", ext = "html")] diff --git a/testing/tests/ui/macro.stderr b/testing/tests/ui/macro.stderr index 3539e4325..f3e13437d 100644 --- a/testing/tests/ui/macro.stderr +++ b/testing/tests/ui/macro.stderr @@ -1,6 +1,4 @@ -error: macro "thrice" expected 1 argument, found 2 - --> InvalidNumberOfArgs.html:5:2 - "- call thrice(2, 3) -%}" +error: the previous template error derives from --> tests/ui/macro.rs:4:21 | 4 | #[template(source = "{%- macro thrice(param) -%} @@ -11,9 +9,7 @@ error: macro "thrice" expected 1 argument, found 2 8 | | {%- call thrice(2, 3) -%}", ext = "html")] | |__________________________^ -error: macro "thrice" expected 2 arguments, found 0 - --> InvalidNumberOfArgs2.html:5:2 - "- call thrice() -%}" +error: the previous template error derives from --> tests/ui/macro.rs:12:21 | 12 | #[template(source = "{%- macro thrice(param, param2) -%} @@ -24,9 +20,7 @@ error: macro "thrice" expected 2 arguments, found 0 16 | | {%- call thrice() -%}", ext = "html")] | |______________________^ -error: macro "thrice" expected 0 arguments, found 2 - --> InvalidNumberOfArgs3.html:4:2 - "- call thrice(1, 2) -%}" +error: the previous template error derives from --> tests/ui/macro.rs:20:21 | 20 | #[template(source = "{%- macro thrice() -%} diff --git a/testing/tests/ui/macro_named_argument.stderr b/testing/tests/ui/macro_named_argument.stderr index 8a5e4d7fc..678d93e24 100644 --- a/testing/tests/ui/macro_named_argument.stderr +++ b/testing/tests/ui/macro_named_argument.stderr @@ -1,6 +1,4 @@ -error: no argument named `param3` in macro "thrice" - --> InvalidNamedArg.html:5:2 - "- call thrice(param1=2, param3=3) -%}" +error: the previous template error derives from --> tests/ui/macro_named_argument.rs:4:21 | 4 | #[template(source = "{%- macro thrice(param1, param2) -%} @@ -11,9 +9,7 @@ error: no argument named `param3` in macro "thrice" 8 | | {%- call thrice(param1=2, param3=3) -%}", ext = "html")] | |________________________________________^ -error: named argument `param1` was passed more than once - --> :5:15 - "(param1=2, param1=3) -%}" +error: the previous template error derives from --> tests/ui/macro_named_argument.rs:12:21 | 12 | #[template(source = "{%- macro thrice(param1, param2) -%} @@ -24,9 +20,7 @@ error: named argument `param1` was passed more than once 16 | | {%- call thrice(param1=2, param1=3) -%}", ext = "html")] | |________________________________________^ -error: failed to parse template source - --> :5:29 - "| filter(param1=12) -%}" +error: the previous template error derives from --> tests/ui/macro_named_argument.rs:21:21 | 21 | #[template(source = "{%- macro thrice(param1, param2) -%} @@ -37,9 +31,7 @@ error: failed to parse template source 25 | | {%- call thrice(3, param1=2) | filter(param1=12) -%}", ext = "html")] | |_____________________________________________________^ -error: named arguments must always be passed last - --> :4:15 - "(param1=2, 3) -%}" +error: the previous template error derives from --> tests/ui/macro_named_argument.rs:30:21 | 30 | #[template(source = "{%- macro thrice(param1, param2) -%} @@ -49,9 +41,7 @@ error: named arguments must always be passed last 33 | | {%- call thrice(param1=2, 3) -%}", ext = "html")] | |_________________________________^ -error: cannot have unnamed argument (`param2`) after named argument in macro "thrice" - --> InvalidNamedArg5.html:4:2 - "- call thrice(3, param1=2) -%}" +error: the previous template error derives from --> tests/ui/macro_named_argument.rs:38:21 | 38 | #[template(source = "{%- macro thrice(param1, param2) -%} diff --git a/testing/tests/ui/match_with_extra.stderr b/testing/tests/ui/match_with_extra.stderr index 16c80b56d..b61838831 100644 --- a/testing/tests/ui/match_with_extra.stderr +++ b/testing/tests/ui/match_with_extra.stderr @@ -1,6 +1,4 @@ -error: failed to parse template source - --> :3:4 - "// Help, I forgot how to write comments!\n {%- when true %}\n good\n {%- when _ -%}\n bad\n{%- endmatch -%}" +error: the previous template error derives from --> tests/ui/match_with_extra.rs:6:14 | 6 | source = r#" diff --git a/testing/tests/ui/multiple_extends.stderr b/testing/tests/ui/multiple_extends.stderr index 8b1960295..3ab64aad2 100644 --- a/testing/tests/ui/multiple_extends.stderr +++ b/testing/tests/ui/multiple_extends.stderr @@ -1,6 +1,4 @@ -error: multiple extend blocks found - --> MyTemplate4.txt:3:2 - " extends \"foo.html\" %}\n" +error: the previous template error derives from --> tests/ui/multiple_extends.rs:4:21 | 4 | #[template(source = r#" diff --git a/testing/tests/ui/name_mismatch_endblock.stderr b/testing/tests/ui/name_mismatch_endblock.stderr index 3ae992aee..2f133c853 100644 --- a/testing/tests/ui/name_mismatch_endblock.stderr +++ b/testing/tests/ui/name_mismatch_endblock.stderr @@ -1,6 +1,4 @@ -error: expected name `foo` in `endblock` tag, found `not_foo` - --> :1:27 - "not_foo %}" +error: the previous template error derives from --> tests/ui/name_mismatch_endblock.rs:4:21 | 4 | #[template(source = "{% block foo %}{% endblock not_foo %}", ext = "html")] diff --git a/testing/tests/ui/name_mismatch_endmacro.stderr b/testing/tests/ui/name_mismatch_endmacro.stderr index ed0985f10..a5bc3fdc0 100644 --- a/testing/tests/ui/name_mismatch_endmacro.stderr +++ b/testing/tests/ui/name_mismatch_endmacro.stderr @@ -1,6 +1,4 @@ -error: expected name `foo` in `endmacro` tag, found `not_foo` - --> :1:41 - "not_foo %}" +error: the previous template error derives from --> tests/ui/name_mismatch_endmacro.rs:4:21 | 4 | #[template(source = "{% macro foo(arg) %} {{arg}} {% endmacro not_foo %}", ext = "html")] diff --git a/testing/tests/ui/no-such-escaper.stderr b/testing/tests/ui/no-such-escaper.stderr index 7952c0783..4d62df34c 100644 --- a/testing/tests/ui/no-such-escaper.stderr +++ b/testing/tests/ui/no-such-escaper.stderr @@ -1,6 +1,4 @@ -error: invalid escaper 'latex' for `escape` filter. The available extensions are: "", "htm", "html", "j2", "jinja", "jinja2", "md", "none", "svg", "txt", "xml", "yml" - --> LocalEscaper.html:1:38 - "text|escape(\"latex\")}}`." +error: the previous template error derives from --> tests/ui/no-such-escaper.rs:6:14 | 6 | source = r#"In LaTeX you write `{{text}}` like `{{text|escape("latex")}}`."#, diff --git a/testing/tests/ui/num-suffix.stderr b/testing/tests/ui/num-suffix.stderr index 2e1446288..d5b7bb98b 100644 --- a/testing/tests/ui/num-suffix.stderr +++ b/testing/tests/ui/num-suffix.stderr @@ -1,22 +1,16 @@ -error: unknown integer suffix `x` - --> :1:3 - "0x0x }}" +error: the previous template error derives from --> tests/ui/num-suffix.rs:7:14 | 7 | source = "{{ 0x0x }}", | ^^^^^^^^^^^^ -error: unknown float suffix `f127` - --> :1:3 - "0.0_f127 }}" +error: the previous template error derives from --> tests/ui/num-suffix.rs:14:14 | 14 | source = "{{ 0.0_f127 }}", | ^^^^^^^^^^^^^^^^ -error: unknown number suffix `u321` - --> :1:3 - "654u321 }}" +error: the previous template error derives from --> tests/ui/num-suffix.rs:21:14 | 21 | source = "{{ 654u321 }}", diff --git a/testing/tests/ui/ref_deref.stderr b/testing/tests/ui/ref_deref.stderr index eb93a2121..579747f43 100644 --- a/testing/tests/ui/ref_deref.stderr +++ b/testing/tests/ui/ref_deref.stderr @@ -1,6 +1,4 @@ -error: failed to parse template source - --> :1:7 - "*x = 2 %}" +error: the previous template error derives from --> tests/ui/ref_deref.rs:4:21 | 4 | #[template(source = "{% let *x = 2 %}", ext = "html")] diff --git a/testing/tests/ui/space-pipe.stderr b/testing/tests/ui/space-pipe.stderr index ca16646ad..59a916c26 100644 --- a/testing/tests/ui/space-pipe.stderr +++ b/testing/tests/ui/space-pipe.stderr @@ -1,16 +1,10 @@ -error: the filter operator `|` must not be preceded by any whitespace characters - the binary OR operator is called `bitor` in rinja - --> :1:3 - " |lower}}" +error: the previous template error derives from --> tests/ui/space-pipe.rs:10:34 | 10 | #[template(ext = "txt", source = "{{a |lower}}")] | ^^^^^^^^^^^^^^ -error: the filter operator `|` must not be preceded by any whitespace characters - the binary OR operator is called `bitor` in rinja - --> :1:3 - " | lower}}" +error: the previous template error derives from --> tests/ui/space-pipe.rs:22:34 | 22 | #[template(ext = "txt", source = "{{a | lower}}")] diff --git a/testing/tests/ui/transclude-missing.stderr b/testing/tests/ui/transclude-missing.stderr index 70ae829cf..0488640dd 100644 --- a/testing/tests/ui/transclude-missing.stderr +++ b/testing/tests/ui/transclude-missing.stderr @@ -1,14 +1,10 @@ -error: template "transclude-missing.html" not found in directories ["$WORKSPACE/target/tests/trybuild/rinja_testing/templates"] - --> testing/templates/transclude-there.html:1:2 - " include \"transclude-missing.html\" %}" +error: the previous template error derives from --> tests/ui/transclude-missing.rs:4:19 | 4 | #[template(path = "transclude-there.html")] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: template "transclude-missing.html" not found in directories ["$WORKSPACE/target/tests/trybuild/rinja_testing/templates"] - --> testing/templates/transclude-there.html:1:2 - " include \"transclude-missing.html\" %}" +error: the previous template error derives from --> tests/ui/transclude-missing.rs:8:21 | 8 | #[template(source = r#"{% include "transclude-there.html" %}"#, ext = "html")] diff --git a/testing/tests/ui/typo_in_keyword.stderr b/testing/tests/ui/typo_in_keyword.stderr index b18eccee7..d391dc992 100644 --- a/testing/tests/ui/typo_in_keyword.stderr +++ b/testing/tests/ui/typo_in_keyword.stderr @@ -1,6 +1,4 @@ -error: failed to parse template source - --> :1:26 - "endfo%}\n1234567890123456789012345678901234567890" +error: the previous template error derives from --> tests/ui/typo_in_keyword.rs:5:14 | 5 | source = "{%for i in 1..=10%}{{i}}{%endfo%}\n1234567890123456789012345678901234567890", diff --git a/testing/tests/ui/unclosed-nodes.stderr b/testing/tests/ui/unclosed-nodes.stderr index 7f81e25d2..f6e84eef6 100644 --- a/testing/tests/ui/unclosed-nodes.stderr +++ b/testing/tests/ui/unclosed-nodes.stderr @@ -1,94 +1,70 @@ -error: unclosed expression, missing "}}" - --> :1:0 - "{{ expr" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:4:21 | 4 | #[template(source = "{{ expr", ext = "txt")] | ^^^^^^^^^ -error: unclosed expression, missing "}}" - --> :1:0 - "{{ expr " +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:8:21 | 8 | #[template(source = "{{ expr ", ext = "txt")] | ^^^^^^^^^^ -error: unclosed expression, missing "}}" - --> :1:0 - "{{ expr -" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:12:21 | 12 | #[template(source = "{{ expr -", ext = "txt")] | ^^^^^^^^^^^ -error: failed to parse template source - --> :1:9 - "}" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:16:21 | 16 | #[template(source = "{{ expr -}", ext = "txt")] | ^^^^^^^^^^^^ -error: unclosed block, missing "%}" - --> :1:0 - "{% let x" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:20:21 | 20 | #[template(source = "{% let x", ext = "txt")] | ^^^^^^^^^^ -error: unclosed block, missing "%}" - --> :1:0 - "{% let x " +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:24:21 | 24 | #[template(source = "{% let x ", ext = "txt")] | ^^^^^^^^^^^ -error: unclosed block, missing "%}" - --> :1:0 - "{% let x -" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:28:21 | 28 | #[template(source = "{% let x -", ext = "txt")] | ^^^^^^^^^^^^ -error: failed to parse template source - --> :1:10 - "%" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:32:21 | 32 | #[template(source = "{% let x -%", ext = "txt")] | ^^^^^^^^^^^^^ -error: unclosed comment, missing "#}" - --> :1:2 - " comment" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:36:21 | 36 | #[template(source = "{# comment", ext = "txt")] | ^^^^^^^^^^^^ -error: unclosed comment, missing "#}" - --> :1:2 - " comment " +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:40:21 | 40 | #[template(source = "{# comment ", ext = "txt")] | ^^^^^^^^^^^^^ -error: unclosed comment, missing "#}" - --> :1:2 - " comment -" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:44:21 | 44 | #[template(source = "{# comment -", ext = "txt")] | ^^^^^^^^^^^^^^ -error: unclosed comment, missing "#}" - --> :1:2 - " comment -#" +error: the previous template error derives from --> tests/ui/unclosed-nodes.rs:48:21 | 48 | #[template(source = "{# comment -#", ext = "txt")]