Skip to content

Commit

Permalink
Rollup merge of #105126 - Sp00ph:const_new_in, r=dtolnay
Browse files Browse the repository at this point in the history
Make `VecDeque::new_in` unstably const

(See #105072)
  • Loading branch information
matthiaskrgr authored Dec 2, 2022
2 parents 4fdc3eb + c959fbe commit 4c4dec4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// let deque: VecDeque<u32> = VecDeque::new();
/// ```
// FIXME: This should probably be const
#[inline]
#[unstable(feature = "allocator_api", issue = "32838")]
pub fn new_in(alloc: A) -> VecDeque<T, A> {
pub const fn new_in(alloc: A) -> VecDeque<T, A> {
VecDeque { head: 0, len: 0, buf: RawVec::new_in(alloc) }
}

Expand Down Expand Up @@ -2152,7 +2151,7 @@ impl<T, A: Allocator> VecDeque<T, A> {

self.head = tail;
} else {
// ´free` is smaller than both `head_len` and `tail_len`.
// `free` is smaller than both `head_len` and `tail_len`.
// the general algorithm for this first moves the slices
// right next to each other and then uses `slice::rotate`
// to rotate them into place:
Expand Down

0 comments on commit 4c4dec4

Please sign in to comment.