Concatenating byte string literals?


#1

In definition of a macro, I need a way to append a b"\0" to the end of the (byte)string literal parameter, to get a static byte slice as the result.

bytes! looks on paper like it could do the job, but: 1) it’s deprecated; 2) it does not even accept bytestring literals as parameters. concat! deals with UTF-8 strings. What else is there to do?


#2

Filed a proposal to resurrect bytes! as an RFC draft.


#3

Is there some specific reason Rust doesn’t automatically coalesce adjacent string literals like C does (and also Python)?