about summary refs log tree commit diff
diff options
context:
space:
mode:
authorcoekjan <cn_yzr@qq.com>2023-10-28 21:30:43 +0800
committercoekjan <cn_yzr@qq.com>2023-10-28 21:30:43 +0800
commit4dd7568a97058c0a2d17f6ace15e42403f93cea1 (patch)
tree07fcdc1e809cd9079e292f76e8b46cb0090cc6b0
parent615d0f2400428eed3b086ca5332369ec150143d6 (diff)
downloadrust-4dd7568a97058c0a2d17f6ace15e42403f93cea1.tar.gz
rust-4dd7568a97058c0a2d17f6ace15e42403f93cea1.zip
mark constructor of `BinaryHeap` as const fn
-rw-r--r--library/alloc/src/collections/binary_heap/mod.rs6
1 files changed, 4 insertions, 2 deletions
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<T: Ord> BinaryHeap<T> {
     /// 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<T> {
+    pub const fn new() -> BinaryHeap<T> {
         BinaryHeap { data: vec![] }
     }
 
@@ -477,8 +478,9 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
     /// 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<T, A> {
+    pub const fn new_in(alloc: A) -> BinaryHeap<T, A> {
         BinaryHeap { data: Vec::new_in(alloc) }
     }