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