Tracking Issue for const_vec_string_slice
· Issue #129041 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Feature gate: #![feature(const_vec_string_slice)]
This is a tracking issue for making a bunch of String
and Vec
methods const
.
Public API
The following methods are now const
:
impl String { pub const fn into_bytes(self) -> Vec; pub const fn as_str(&self) -> &str; pub const fn capacity(&self) -> usize; pub const fn as_bytes(&self) -> &[u8]; pub const fn len(&self) -> usize; pub const fn is_empty(&self) -> bool; }
impl Vec { pub const fn capacity(&self) -> usize; pub const fn as_slice(&self) -> &[T]; pub const fn as_ptr(&self) -> *const T; pub const fn len(&self) -> usize; pub const fn is_empty(&self) -> bool; }
A few additional methods are under this feature gate but were not included in the FCP at #129041 (comment); they got FCP'd in #137319 (comment):
impl String { pub const fn as_mut_str(&mut self) -> &mut str; pub const unsafe fn as_mut_vec(&mut self) -> &mut Vec; }
impl Vec { pub const fn as_mut_slice(&mut self) -> &mut [T]; pub const fn as_mut_ptr(&mut self) -> *mut T; }
Steps / History
- Implementation: liballoc: introduce String, Vec const-slicing #128399
- Final comment period (FCP)1
- Stabilization PR: Stabilize const_vec_string_slice #137319
Unresolved Questions
- None yet.
@rustbot label A-str