We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d6da428 + 2fba078 commit 1d12c3cCopy full SHA for 1d12c3c
library/alloc/src/collections/vec_deque/mod.rs
@@ -535,12 +535,13 @@ impl<T> VecDeque<T> {
535
///
536
/// let deque: VecDeque<u32> = VecDeque::new();
537
/// ```
538
- // FIXME: This should probably be const
539
#[inline]
540
#[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_stable(feature = "const_vec_deque_new", since = "CURRENT_RUSTC_VERSION")]
541
#[must_use]
542
- pub fn new() -> VecDeque<T> {
543
- VecDeque::new_in(Global)
+ pub const fn new() -> VecDeque<T> {
+ // FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
544
+ VecDeque { head: 0, len: 0, buf: RawVec::NEW }
545
}
546
547
/// Creates an empty deque with space for at least `capacity` elements.
0 commit comments