Skip to content

Tracking Issue for const_cstr_methods #101719

Closed

Description

@WaffleLapkin

Feature gate: #![feature(const_cstr_methods)]

This is a tracking issue for CStr methods as const functions.

Public API

// core::ffi

impl CStr {
    // feature(const_cstr_methods)
    pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>;
    pub const fn to_bytes(&self) -> &[u8];
    pub const fn to_bytes_with_nul(&self) -> &[u8];
    pub const fn to_str(&self) -> Result<&str, str::Utf8Error>;
}

// Note that those methods are stable, they are only unstable as `const` fn

Steps / History

Unresolved Questions

  • None yet.

Footnotes

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

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-libs-api[DEPRECATED; DO NOT USE]
    on Sep 12, 2022
  2. added 2 commits that reference this issue on Oct 28, 2022
  3. added 2 commits that reference this issue on Oct 29, 2022
  4. tgross35 commented on Feb 1, 2023

    @tgross35
    Member

    @WaffleLapkin are any of these uncontroversial enough that you'd be comfortable const stabilizing them?

    For #107429 I had to mark some of the memchr functions const stable, and the methods here largely have the same const dependencies. So, at least a subset of these could probably go const stable in the same release.

  5. WaffleLapkin commented on Feb 2, 2023

    @WaffleLapkin
    MemberAuthor

    @tgross35 I personally think that all of these are uncontroversial and I'd be very comfortable stabilizing them, however I do not posses the power to do so. Stabilizing library APIs is a prerogative of T-libs-api.

  6. tgross35 commented on Feb 2, 2023

    @tgross35
    Member

    Rightieo, I just was wondering if you had any bad feeling that any of them would be unmaintainable as const.

    I think the FCP could take place on the PR since this is quite small, similarly to #107429. Would you like to make the stabilization PR? If not, I don't mind doing it tomorrow. (in either case, using my commit 877e9f5 as a base is likely a good idea to avoid a smidge of rebasing once #107429 is in)

  7. WaffleLapkin commented on Feb 2, 2023

    @WaffleLapkin
    MemberAuthor

    I'll live the PR to you :)

  8. tgross35 commented on Feb 3, 2023

    @tgross35
    Member

    Alright, I've opened #107624

  9. added a commit that references this issue on Jun 30, 2023
  10. added a commit that references this issue on Jun 30, 2023
  11. tgross35 commented on Jul 1, 2023

    @tgross35
    Member

    @WaffleLapkin I think you can close this tracking issue if you would like, since #107624 merged. CStr::from_ptr was under this gate (I don't see it in this description) but moved to const_cstr_from_ptr with the merge, and I opened a new issue to track that #113219

  12. added 3 commits that reference this issue on Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions