RFC: Introduce concat_bytes!() to join [u8] and byte str analogous to concat! for str by estebank · Pull Request #2509 · rust-lang/rfcs (original) (raw)

We discussed this in today's @rust-lang/libs meeting, and came to a resolution on the question of integer literals:

We'd like to reject bare integer literals, and only allow arrays of integer literals. So, concat_bytes!(b"hello", [1, 2, 3], "world") would be accepted, but concat_bytes!(b"hello", 1, 2, 3, "world") would not be.

It would also be nice to have a diagnostic with a suggestion, that suggests wrapping a series of integer literals with square brackets. So, concat_bytes!(b"hello", 1, 2, 3, "world") should get a rustfix-applicable suggestion to become concat_bytes!(b"hello", [1, 2, 3], "world").