stablize const_binary_heap_constructor & create an unstable feature const_binary_heap_new_in for BinaryHeap::new_in

This commit is contained in:
coekjan 2024-05-17 21:18:51 +08:00
parent 20be84a7e6
commit 7cee7c664b
No known key found for this signature in database
GPG Key ID: E2B19491B838BB2B

View File

@ -440,7 +440,10 @@ impl<T: Ord> BinaryHeap<T> {
/// heap.push(4); /// heap.push(4);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")] #[rustc_const_stable(
feature = "const_binary_heap_constructor",
since = "CURRENT_RUSTC_VERSION"
)]
#[must_use] #[must_use]
pub const fn new() -> BinaryHeap<T> { pub const fn new() -> BinaryHeap<T> {
BinaryHeap { data: vec![] } BinaryHeap { data: vec![] }
@ -484,7 +487,7 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
/// heap.push(4); /// heap.push(4);
/// ``` /// ```
#[unstable(feature = "allocator_api", issue = "32838")] #[unstable(feature = "allocator_api", issue = "32838")]
#[rustc_const_unstable(feature = "const_binary_heap_constructor", issue = "112353")] #[rustc_const_unstable(feature = "const_binary_heap_new_in", issue = "112353")]
#[must_use] #[must_use]
pub const fn new_in(alloc: A) -> BinaryHeap<T, A> { pub const fn new_in(alloc: A) -> BinaryHeap<T, A> {
BinaryHeap { data: Vec::new_in(alloc) } BinaryHeap { data: Vec::new_in(alloc) }