mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-27 13:00:57 +00:00
Forbid string literal suffix
This commit is contained in:
parent
d8bf38978c
commit
6de8ff8042
@ -687,7 +687,7 @@ fn str_lit<'a>(i: &mut &'a str) -> ParseResult<'a, StrLit<'a>> {
|
||||
}
|
||||
|
||||
fn not_suffix_with_hash<'a>(i: &mut &'a str) -> ParseResult<'a, ()> {
|
||||
if let Some(suffix) = opt((identifier, '#').take()).parse_next(i)? {
|
||||
if let Some(suffix) = opt(identifier.take()).parse_next(i)? {
|
||||
return cut_error!(
|
||||
"you are missing a space to separate two string literals",
|
||||
suffix,
|
||||
|
12
testing/tests/ui/macro-args.rs
Normal file
12
testing/tests/ui/macro-args.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// This test ensures that the proc-macro fails if two arguments are not separated.
|
||||
|
||||
use askama::Template;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(
|
||||
source = r###"{{e!{ r#""#r" \ "}}}"###,
|
||||
ext = "html"
|
||||
)]
|
||||
struct Example;
|
||||
|
||||
fn main() {}
|
7
testing/tests/ui/macro-args.stderr
Normal file
7
testing/tests/ui/macro-args.stderr
Normal file
@ -0,0 +1,7 @@
|
||||
error: you are missing a space to separate two string literals
|
||||
--> <source attribute>:1:11
|
||||
"r\" \\ \"}}}"
|
||||
--> tests/ui/macro-args.rs:7:14
|
||||
|
|
||||
7 | source = r###"{{e!{ r#""#r" \ "}}}"###,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Loading…
x
Reference in New Issue
Block a user