rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.16k stars 12.8k forks source link

Tracking Issue for `std::ffi::c_str` module #112134

Open clarfonthey opened 1 year ago

clarfonthey commented 1 year ago

Feature gate: #![feature(c_str_module)]

This is a tracking issue for the std::ffi::c_str module.

Public API

This adds {core, alloc, std}::ffi::c_str modules and migrates some existing types into them. Types will still be re-exported in their current places to ensure compatibility.

The following migrations are made:

And these types are also migrated on the std crate as well.

Steps / History

Unresolved Questions

dtolnay commented 4 months ago

@rust-lang/libs-api: @rfcbot fcp merge

This module has been available since 1.78-nightly, and is valuable in tidying all those types you will never need to name out of std::ffi's "Structs" section.

Without modules, are you able to guess whether std::ffi::IntoStringError refers to the error type returned by std::ffi::CString::into_string or by std::ffi::OsString::into_string?

Before:

After:

rfcbot commented 4 months ago

Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

clarfonthey commented 4 months ago

Note that the os_str module, while part of the initial ACP, was rejected, and isn't part of this tracking issue. If you'd like to include it as part of the FCP, I would not oppose, but that should be stated explicitly instead of being roped in implicitly. Just don't want to avoid a headache when it comes to stabilisation.

joshtriplett commented 4 months ago

For people wanting to follow std::ffi::os_str, it's https://github.com/rust-lang/rust/issues/120048 .

rfcbot commented 4 months ago

:bell: This is now entering its final comment period, as per the review above. :bell:

rfcbot commented 4 months ago

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.