diff --git a/rinja_parser/src/target.rs b/rinja_parser/src/target.rs index 6e81b4fe..5aa21374 100644 --- a/rinja_parser/src/target.rs +++ b/rinja_parser/src/target.rs @@ -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, ))); } diff --git a/testing/tests/ui/rest_pattern.stderr b/testing/tests/ui/rest_pattern.stderr index c384da5d..95b41c13 100644 --- a/testing/tests/ui/rest_pattern.stderr +++ b/testing/tests/ui/rest_pattern.stderr @@ -35,7 +35,7 @@ error: unexpected `,` character after `..` 31 | | "#, | |__^ -error: `@ ..` cannot be used in tuple +error: `@ ..` is only allowed in slice patterns --> :2:18 "who @ .., 4) = (1, 2, 3, 4) -%}\n{%- endif -%}\n" --> tests/ui/rest_pattern.rs:39:14