diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index 66573b90db9..61c5950b027 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -434,8 +434,9 @@ impl BinaryHeap { /// heap.push(4); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")] #[must_use] - pub fn new() -> BinaryHeap { + pub const fn new() -> BinaryHeap { BinaryHeap { data: vec![] } } @@ -477,8 +478,9 @@ impl BinaryHeap { /// heap.push(4); /// ``` #[unstable(feature = "allocator_api", issue = "32838")] + #[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")] #[must_use] - pub fn new_in(alloc: A) -> BinaryHeap { + pub const fn new_in(alloc: A) -> BinaryHeap { BinaryHeap { data: Vec::new_in(alloc) } }