Skip to content

Commit

Permalink
Unrolled build for rust-lang#123661
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#123661 - tgross35:stabilize-cstr_count_bytes, r=dtolnay

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 <rust-lang#113219>.

FCP finished at rust-lang#114441 (comment).

Fixes: <rust-lang#114441>
  • Loading branch information
rust-timer authored Apr 11, 2024
2 parents aa067fb + 0ef49fe commit cffb07d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit cffb07d

Please sign in to comment.