mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 13:30:59 +00:00
Improve compilation error message for invalid usage of rest pattern
This commit is contained in:
parent
c860a22e85
commit
4de78ad9be
@ -238,7 +238,7 @@ fn only_one_rest_pattern<'a>(
|
||||
if let Target::Rest(s) = target {
|
||||
if !allow_named_rest && s.inner.is_some() {
|
||||
return Err(nom::Err::Failure(ErrorContext::new(
|
||||
format!("`@ ..` cannot be used in {type_kind}"),
|
||||
"`@ ..` is only allowed in slice patterns",
|
||||
s.span,
|
||||
)));
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ error: unexpected `,` character after `..`
|
||||
31 | | "#,
|
||||
| |__^
|
||||
|
||||
error: `@ ..` cannot be used in tuple
|
||||
error: `@ ..` is only allowed in slice patterns
|
||||
--> <source attribute>:2:18
|
||||
"who @ .., 4) = (1, 2, 3, 4) -%}\n{%- endif -%}\n"
|
||||
--> tests/ui/rest_pattern.rs:39:14
|
||||
|
Loading…
x
Reference in New Issue
Block a user