Skip to content
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

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

Open
2 of 5 tasks
clarfonthey opened this issue May 31, 2023 · 6 comments
Open
2 of 5 tasks

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

clarfonthey opened this issue May 31, 2023 · 6 comments
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Comments

@clarfonthey
Copy link
Contributor

clarfonthey commented May 31, 2023

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:

  • core::ffi::CStr => core::ffi::c_str::CStr
  • core::ffi::FromBytesUntilNulError => core::ffi::c_str::FromBytesUntilNulError
  • core::ffi::FromBytesWithNulError => core::ffi::c_str::FromBytesWithNulError
  • alloc::ffi::CString => alloc::ffi::c_str::CString
  • alloc::ffi::FromVecWIthNulError => alloc::ffi::c_str::FromVecWIthNulError
  • alloc::ffi::IntoStringError => alloc::ffi::c_str::IntoStringError
  • alloc::ffi::NulError => alloc::ffi::c_str::NulError

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

Steps / History

Unresolved Questions

  • Should c_str and c_string be separated? This was not discussed in the original ACP.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/api-change-proposals.html

  2. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@clarfonthey clarfonthey added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 31, 2023
@clarfonthey clarfonthey changed the title Tracking Issue for std::ffi::c_str module Tracking Issue for {core, std}::ffi::c_str and {alloc, std}::ffi::c_string modules May 31, 2023
@clarfonthey clarfonthey changed the title Tracking Issue for {core, std}::ffi::c_str and {alloc, std}::ffi::c_string modules Tracking Issue for {core, alloc, std}::ffi::c_str module Jun 1, 2023
@clarfonthey clarfonthey changed the title Tracking Issue for {core, alloc, std}::ffi::c_str module Tracking Issue for std::ffi::c_str module Jun 1, 2023
@dtolnay
Copy link
Member

dtolnay commented Jul 20, 2024

@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
Copy link

rfcbot commented Jul 20, 2024

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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 20, 2024
@clarfonthey
Copy link
Contributor Author

clarfonthey commented Jul 20, 2024

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
Copy link
Member

For people wanting to follow std::ffi::os_str, it's #120048 .

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jul 23, 2024
@rfcbot
Copy link

rfcbot commented Jul 23, 2024

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

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Aug 2, 2024
@rfcbot
Copy link

rfcbot commented Aug 2, 2024

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.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

No branches or pull requests

4 participants