Rollup merge of #100291 - WaffleLapkin:cstr_const_methods, r=oli-obk
constify some `CStr` methods
This PR marks the following public APIs as `const`:
```rust
impl CStr {
// feature(const_cstr_from_bytes)
pub const fn from_bytes_until_nul(bytes: &[u8]) -> Result<&CStr, FromBytesUntilNulError>;
pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>;
// feature(const_cstr_to_bytes)
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>;
}
```
r? ```@oli-obk``` (use of `const_eval_select` :P )
cc ```@mina86``` (you've asked for this <3 )
This commit is contained in:
@@ -159,6 +159,7 @@
|
||||
#![feature(const_slice_from_ref)]
|
||||
#![feature(const_slice_index)]
|
||||
#![feature(const_is_char_boundary)]
|
||||
#![feature(const_cstr_methods)]
|
||||
//
|
||||
// Language features:
|
||||
#![feature(abi_unadjusted)]
|
||||
|
||||
Reference in New Issue
Block a user