Auto merge of #105127 - Sp00ph:const_new, r=dtolnay
Make `VecDeque::new` const (See #105072)
This commit is contained in:
commit
1d12c3cea3
@ -535,12 +535,13 @@ impl<T> VecDeque<T> {
|
||||
///
|
||||
/// let deque: VecDeque<u32> = VecDeque::new();
|
||||
/// ```
|
||||
// FIXME: This should probably be const
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_stable(feature = "const_vec_deque_new", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[must_use]
|
||||
pub fn new() -> VecDeque<T> {
|
||||
VecDeque::new_in(Global)
|
||||
pub const fn new() -> VecDeque<T> {
|
||||
// FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
|
||||
VecDeque { head: 0, len: 0, buf: RawVec::NEW }
|
||||
}
|
||||
|
||||
/// Creates an empty deque with space for at least `capacity` elements.
|
||||
|
Loading…
x
Reference in New Issue
Block a user