-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Support Cstr literals #2710
Comments
I think the stabilization is getting reverted, unfortunately: |
A bit unfortunate -- although I think bindgen support will be benefitted by the revert so more features (like proc_macro C string literals in rust-lang/rust#119750) can make it in. Bindgen support for this I think will be blocked by |
Seems fine to add an experimental feature. See |
Looks like it will be re-stabilized in 1.78 on 3/21/24. How would this interact with the existing generate_cstr option that will "will become enabled by default in a future release"? Would this just change the generated code from using |
I agree with @emilio, adding this as a nightly only feature meanwhile makes sense. If this feature is merged before the compiler feature is stabilized we can stabilize this feature and update the |
C-string literals was stabilized in Rust 1.77: https://blog.rust-lang.org/2024/03/21/Rust-1.77.0.html#c-string-literals |
A feature which automatically represented all strings without an embedded null as |
CStr
literals (c"Hello, world!"
) and raw literals (cr"Hello, World!"
) are supported as of rust-lang/rust#117472 and will be stabilized in ~1month. Would it be possible to add an option to emit this type of literal instead of&'static [u8]
for string literals? If it sounds like a good idea, I can try and take a pass at it, it'd be nice for several of my projects.The text was updated successfully, but these errors were encountered: