Skip to content

Commit 431dadf

Browse files
jplatteestebank
authored andcommitted
byte-concat: Address argument type concern
1 parent 32ed992 commit 431dadf

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

text/0000-byte-concat.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ supported as inputs:
2525

2626
- byte string literals (`b"..."`)
2727
- byte literals (`b'b'`)
28-
- numeric literals – must fit in `u8`, any number larger than `u8::MAX` causes
29-
a compile time error like the following:
30-
31-
```
32-
error: cannot concatenate a non-`u8` literal in a byte string literal
33-
--> $FILE:XX:YY
34-
|
35-
XX | concat_bytes!(256, b"val");
36-
| ^^^ this value is larger than `255`
37-
```
3828
- numeric array literals – if any literal is outside of `u8` range, it will
3929
cause a compile time error:
4030

@@ -64,6 +54,11 @@ string literals, like a previous revision of this RFC proposed. This would make
6454
it hard to ensure the right output type is produced – users would have to use
6555
hacks like adding a dummy `b""` argument to force a byte literal output.
6656

57+
An earlier version of this RFC proposed to support integer literals outside of
58+
arrays, but that was rejected since it would make the output of
59+
`byte_concat!(123, b"\n")` inconsistent with the equivalent `concat!`
60+
invocation.
61+
6762
# Unresolved questions
6863
[unresolved-questions]: #unresolved-questions
6964

@@ -72,8 +67,3 @@ hacks like adding a dummy `b""` argument to force a byte literal output.
7267
support those as well (support `&[0, 1, 2]` in addition to `[0, 1, 2]`).
7368
- What to do with string and character literals? They could either be supported
7469
with their underlying UTF-8 representation being concatenated, or rejected.
75-
- If supported, it would probably make sense to also support boolean literals
76-
so `concat_bytes!()` supports all inputs `concat!()` does.
77-
- If rejected, it would probably makes sense to also reject boolean literals
78-
to avoid any possible confusion about their representation (`true` and
79-
`false` vs. `1` and `0`).

0 commit comments

Comments
 (0)