Skip to content

Commit f30e5ba

Browse files
committed
Update!
1 parent b4ccc53 commit f30e5ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

text/3348-c-str-literal.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Nul bytes are disallowed, whether as escape code or source character (e.g. `"\0"
3939
Unicode characters are accepted and encoded as UTF-8. That is, `c"🦀"`, `c"\u{1F980}"` and `c"\xf0\x9f\xa6\x80"` are all accepted and equivalent.
4040

4141
The type of the expression is [`&core::ffi::CStr`](https://doc.rust-lang.org/stable/core/ffi/struct.CStr.html). So, the `CStr` type will have to become a lang item.
42+
(`no_core` programs that don't use `c""` string literals won't need to define this lang item.)
4243

4344
Interactions with string related macros:
4445

@@ -124,6 +125,12 @@ Interactions with string related macros:
124125
# Future possibilities
125126
[future-possibilities]: #future-possibilities
126127

128+
(These aren't necessarily all good ideas.)
129+
127130
- Make `concat!()` or `concat_bytes!()` work with `c"…"`.
128131
- Make `format_args!(c"…")` (and `format_args!(b"…")`) work.
129132
- Improve the `&CStr` type, and make it FFI safe.
133+
- Accept unicode characters and escape codes in `b""` literals too: [RFC 3349](https://github.com/rust-lang/rfcs/pull/3349).
134+
- More prefixes! `w""`, `os""`, `path""`, `utf16""`, `brokenutf16""`, `utf32""`, `wtf8""`, `ebcdic""`, …
135+
- No more prefixes! Have `let a: &CStr = "…";` work through magic, removing the need for prefixes.
136+
(That won't happen any time soon probably, so that shouldn't block `c"…"` now.)

0 commit comments

Comments
 (0)