diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-04-08 22:38:59 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-04-08 22:38:59 -0400 |
| commit | 0ef49fe35d14bacaab14658cd8a601dae5d5f415 (patch) | |
| tree | f65ce7ec0bd747ad141a95f0e82b8abf3b134174 | |
| parent | b234e449443a49ab19ef6b712bf56cc65927d98f (diff) | |
| download | rust-0ef49fe35d14bacaab14658cd8a601dae5d5f415.tar.gz rust-0ef49fe35d14bacaab14658cd8a601dae5d5f415.zip | |
Stabilize `cstr_count_bytes`
Newly stable API:
```rust
impl CStr {
pub fn count_bytes(&self) -> usize;
}
```
Const stabilization has not yet been decided, so that will continue to be
gated under <https://github.com/rust-lang/rust/issues/113219>.
Fixes: <https://github.com/rust-lang/rust/issues/114441>
| -rw-r--r-- | library/core/src/ffi/c_str.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index dbdbaccb535..f4f33f8584b 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -517,8 +517,6 @@ impl CStr { /// # Examples /// /// ``` - /// #![feature(cstr_count_bytes)] - /// /// use std::ffi::CStr; /// /// let cstr = CStr::from_bytes_with_nul(b"foo\0").unwrap(); @@ -530,7 +528,7 @@ impl CStr { #[inline] #[must_use] #[doc(alias("len", "strlen"))] - #[unstable(feature = "cstr_count_bytes", issue = "114441")] + #[stable(feature = "cstr_count_bytes", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cstr_from_ptr", issue = "113219")] pub const fn count_bytes(&self) -> usize { self.inner.len() - 1 |
