Skip to content

Conversation

@MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented Dec 7, 2023

These will land in Rust 1.76 have landed in Rust 1.77 just now and automatically append a \0 terminator in the compiler without having to have a checked or unsafe-unchecked constructor on CStr.

Hacking in an invalid \0 anywhere in the string is disallowed with a compiler error.

Note that proc-macro, and by extension proc-macro2 only has support for parsing this literal, but not for emitting it yet.

@MarijnS95 MarijnS95 force-pushed the cstr-literal branch 5 times, most recently from f6949e5 to e7ee21c Compare December 10, 2023 17:08
@Friz64
Copy link
Contributor

Friz64 commented Mar 21, 2024

C-string literals have now landed in Rust 1.77.

@MarijnS95 MarijnS95 force-pushed the cstr-literal branch 2 times, most recently from 3442ad4 to 1b9d5be Compare March 24, 2024 16:33
These will land in Rust 1.76 and automatically append a `\0` terminator
in the compiler without having to have a checked or `unsafe`-unchecked
constructor on `CStr`.

Hacking in an invalid `\0` anywhere in the string is disallowed with a
compiler error.

Note that `proc-macro`, and by extension `proc-macro2` only has support
for parsing this literal, but not for emitting it yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants