Skip to content

Commit a1306b6

Browse files
committed
Update.
1 parent df9bd28 commit a1306b6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

text/3348-c-str-literal.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Motivation
1212
[motivation]: #motivation
1313

14-
Looking at the [amount of `cstr!()` invocations just on GitHub](https://cs.github.com/?scopeName=All+repos&scope=&q=cstr%21+lang%3Arust) it seems like C string literals
14+
Looking at the [amount of `cstr!()` invocations just on GitHub](https://cs.github.com/?scopeName=All+repos&scope=&q=cstr%21+lang%3Arust) (about 3.2k files with matches) it seems like C string literals
1515
are a widely used feature. Implementing `cstr!()` as a `macro_rules` or `proc_macro` requires non-trivial code to get it completely right (e.g. refusing embedded nul bytes),
1616
and is still less flexible than it should be (e.g. in terms of accepted escape codes).
1717

@@ -25,7 +25,7 @@ In Rust 2021, we reserved prefixes for (string) literals, so let's make use of t
2525
All escape codes and characters accepted by `""` and `b""` literals are accepted, except the nul byte (`\0`).
2626
So, both UTF-8 and non-UTF-8 data can co-exist in a C string. E.g. `c"hello\x80我叫\u{1F980}"`.
2727

28-
The raw string literal variant is prefixed with `cr`. For example, `cr"\"` and `r##"Hello "world"!"##`. (Just like `r""` and `br""`.)
28+
The raw string literal variant is prefixed with `cr`. For example, `cr"\"` and `cr##"Hello "world"!"##`. (Just like `r""` and `br""`.)
2929

3030
# Reference-level explanation
3131
[reference-level-explanation]: #reference-level-explanation
@@ -97,6 +97,7 @@ Interactions with string related macros:
9797
# Prior art
9898
[prior-art]: #prior-art
9999

100+
- C as C string literals (`"…"`). :)
100101
- NIM has `cstring"…"`.
101102
- COBOL has `Z"…"`.
102103
- Probably a lot more languages, but it's hard to search for. :)

0 commit comments

Comments
 (0)