about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/messages.ftl
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-06-18 20:08:15 -0400
committerTrevor Gross <tmgross@umich.edu>2025-06-19 16:13:20 +0000
commit044c99df78da9464e2ad0a90494af1e584123ab4 (patch)
tree0aa346ba15153954fb12cfebb05791e8281ac20a /compiler/rustc_builtin_macros/messages.ftl
parent342f07ab31d523c17eb1fb8fe8aee48674309e23 (diff)
downloadrust-044c99df78da9464e2ad0a90494af1e584123ab4.tar.gz
rust-044c99df78da9464e2ad0a90494af1e584123ab4.zip
Improve diagnostics for `concat_bytes!` with C string literals
Use the same error as other invalid types for `concat_bytes!`, rather
than using `ConcatCStrLit` from `concat!`. Also add more information
with a note about why this doesn't work, and a suggestion to use a
null-terminated byte string instead.
Diffstat (limited to 'compiler/rustc_builtin_macros/messages.ftl')
-rw-r--r--compiler/rustc_builtin_macros/messages.ftl2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_builtin_macros/messages.ftl b/compiler/rustc_builtin_macros/messages.ftl
index d32e6f1558e..c5d1f2ad2de 100644
--- a/compiler/rustc_builtin_macros/messages.ftl
+++ b/compiler/rustc_builtin_macros/messages.ftl
@@ -104,6 +104,8 @@ builtin_macros_concat_bytes_bad_repeat = repeat count is not a positive number
 builtin_macros_concat_bytes_invalid = cannot concatenate {$lit_kind} literals
     .byte_char = try using a byte character
     .byte_str = try using a byte string
+    .c_str = try using a null-terminated byte string
+    .c_str_note = concatenating C strings is ambiguous about including the '\0'
     .number_array = try wrapping the number in an array
 
 builtin_macros_concat_bytes_missing_literal = expected a byte literal