about summary refs log tree commit diff
path: root/compiler/rustc_parse/messages.ftl
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2024-09-23 02:12:53 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2024-09-23 02:12:53 +0300
commit9cd668beed38a8e98933733854a224c70998bf16 (patch)
tree0ac8ea5f3c8b8839224855bac9725e19c323137f /compiler/rustc_parse/messages.ftl
parent8ed95d1d9e149b5242316c91b3849c58f8320470 (diff)
downloadrust-9cd668beed38a8e98933733854a224c70998bf16.tar.gz
rust-9cd668beed38a8e98933733854a224c70998bf16.zip
Parser: better error messages for `@` in struct patterns
Diffstat (limited to 'compiler/rustc_parse/messages.ftl')
-rw-r--r--compiler/rustc_parse/messages.ftl7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl
index 6cb851eb8df..5d1c300b453 100644
--- a/compiler/rustc_parse/messages.ftl
+++ b/compiler/rustc_parse/messages.ftl
@@ -26,6 +26,13 @@ parse_async_move_block_in_2015 = `async move` blocks are only allowed in Rust 20
 parse_async_move_order_incorrect = the order of `move` and `async` is incorrect
     .suggestion = try switching the order
 
+parse_at_dot_dot_in_struct_pattern = `@ ..` is not supported in struct patterns
+    .suggestion = bind to each field separately or, if you don't need them, just remove `{$ident} @`
+
+parse_at_in_struct_pattern = Unexpected `@` in struct pattern
+    .note = struct patterns use `field: pattern` syntax to bind to fields
+    .help = consider replacing `new_name @ field_name` with `field_name: new_name` if that is what you intended
+
 parse_attr_after_generic = trailing attribute after generic parameter
     .label = attributes must go before parameters