Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

derive: properly display error locations (second attempt) #103

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rinja_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
41 changes: 40 additions & 1 deletion rinja_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -227,6 +234,38 @@ impl CompileError {
file_info: Option<FileInfo<'_>>,
span: Option<Span>,
) -> 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(),
Expand Down
1 change: 1 addition & 0 deletions rinja_derive_standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 6 additions & 18 deletions testing/tests/ui/as-primitive-type.stderr
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
error: `as` operator expects the name of a primitive type on its right-hand side
--> <source attribute>: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
--> <source attribute>: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`
--> <source attribute>: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`
--> <source attribute>: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`
--> <source attribute>: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`
--> <source attribute>: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")]
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/block_in_filter_block.stderr
Original file line number Diff line number Diff line change
@@ -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" %}
Expand Down
12 changes: 3 additions & 9 deletions testing/tests/ui/blocks_below_top_level.stderr
Original file line number Diff line number Diff line change
@@ -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#"
Expand All @@ -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#"
Expand All @@ -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#"
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/break_outside_of_loop.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
error: you can only `break` inside a `for` loop
--> <source attribute>: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!",
Expand Down
32 changes: 8 additions & 24 deletions testing/tests/ui/char_literal.stderr
Original file line number Diff line number Diff line change
@@ -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
--> <source attribute>: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")]
Expand Down
12 changes: 3 additions & 9 deletions testing/tests/ui/error_file_path.stderr
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/excessive_nesting.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
error: your template code is too deeply nested, or last expression is too complex
--> <source attribute>: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 = "
Expand Down
8 changes: 2 additions & 6 deletions testing/tests/ui/extends.stderr
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
error: whitespace control is not allowed on `extends`
--> <source attribute>: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`
--> <source attribute>:1:2
" extends \"whatever.html\" -%}"
error: the previous template error derives from
--> tests/ui/extends.rs:12:14
|
12 | source = r#"{% extends "whatever.html" -%}"#,
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/filter-recursion.stderr
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/filter_block_ws.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
error: failed to parse template source
--> <source attribute>: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) - %}
Expand Down
4 changes: 1 addition & 3 deletions testing/tests/ui/include-a-folder.stderr
Original file line number Diff line number Diff line change
@@ -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" %}"#)]
Expand Down
Loading
Loading