Skip to content

Commit 2dd37d4

Browse files
Rollup merge of #117316 - Coekjan:const-binary-heap-constructor, r=dtolnay
Mark constructor of `BinaryHeap` as const fn #112353
2 parents 10c9c7c + 4dd7568 commit 2dd37d4

File tree

1 file changed

+4
-2
lines changed
  • library/alloc/src/collections/binary_heap

1 file changed

+4
-2
lines changed

library/alloc/src/collections/binary_heap/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,9 @@ impl<T: Ord> BinaryHeap<T> {
434434
/// heap.push(4);
435435
/// ```
436436
#[stable(feature = "rust1", since = "1.0.0")]
437+
#[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")]
437438
#[must_use]
438-
pub fn new() -> BinaryHeap<T> {
439+
pub const fn new() -> BinaryHeap<T> {
439440
BinaryHeap { data: vec![] }
440441
}
441442

@@ -477,8 +478,9 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
477478
/// heap.push(4);
478479
/// ```
479480
#[unstable(feature = "allocator_api", issue = "32838")]
481+
#[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")]
480482
#[must_use]
481-
pub fn new_in(alloc: A) -> BinaryHeap<T, A> {
483+
pub const fn new_in(alloc: A) -> BinaryHeap<T, A> {
482484
BinaryHeap { data: Vec::new_in(alloc) }
483485
}
484486

0 commit comments

Comments
 (0)