Skip to content

Commit 8f153a3

Browse files
committed
Increase MSRV to 1.52.0
- Unconditionally set `deny(unsafe_op_in_unsafe_fn)` - Unconditionally implement `From<BinaryHeap<T, C>>` for `Vec<T>` and remove conditional implementation of `Into<Vec<T>>` for `BinaryHeap<T, C>` - Use intra-doc links
1 parent 851b5f6 commit 8f153a3

File tree

5 files changed

+12
-48
lines changed

5 files changed

+12
-48
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- macos-latest
1717
rust:
1818
- stable
19-
- 1.36.0 # MSRV (Rust 2018 and dev-dependency `serde_json`)
19+
- 1.52.0 # MSRV
2020
cargo_args:
2121
- ""
2222
- --features serde
@@ -26,12 +26,6 @@ jobs:
2626
- os: ubuntu-latest
2727
rust: nightly
2828
cargo_args: ""
29-
- os: ubuntu-latest
30-
rust: 1.41.0
31-
cargo_args: ""
32-
- os: ubuntu-latest
33-
rust: 1.52.0
34-
cargo_args: ""
3529
- os: ubuntu-latest
3630
rust: 1.56.0
3731
cargo_args: ""

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
* `#[must_use]` attribute to many methods, porting and extending several
1212
rust-lang/rust PRs
1313
* Method `shrink_to()` for Rust 1.56.0 and greater, ported from rust-lang/rust
14-
* Implementation of `From<BinaryHeap<T, C>>` for `Vec<T>` for Rust 1.41.0 or
15-
greater
1614
* Implementation of `From<[T; N]>` for `BinaryHeap<T>` for Rust 1.56.0 or
1715
greater, ported from rust-lang/rust#84111
1816
* Links to referenced items in the documenation
@@ -22,7 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2220

2321
### Changed
2422

25-
* Bump MSRV (minimum supported rust version) to rust 1.36.0.
23+
* Bump MSRV (minimum supported rust version) to rust 1.52.0.
24+
* Implement `From<BinaryHeap<T, C>>` for `Vec<T>` instead of `Into<Vec<T>>` for
25+
`BinaryHeap<T, C>`
2626
* Port rust-lang/rust#77435 improvement to rebuild heuristic of
2727
`BinaryHeap::append()`
2828
* Use italics with big-O notation in documentation, ported from

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This crate is based on the standard library's implementation of
2626
[`BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html)
2727
from Rust 1.62.0.
2828

29-
This crate requires Rust 1.36.0 or later. A few of its APIs are only available
29+
This crate requires Rust 1.52.0 or later. A few of its APIs are only available
3030
for more recent versions of Rust where they have been stabilized in the
3131
standard library; see the documentation for specifics.
3232

build.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
fn main() {
22
let ac = autocfg::new();
33

4-
// Required in order to implement `From<BinaryHeap<T, C>>` for `Vec<T>`.
5-
ac.emit_rustc_version(1, 41);
6-
7-
// Required for stabilization of `unsafe_op_in_unsafe_fn` lint.
8-
ac.emit_rustc_version(1, 52);
9-
104
// Required for stabilization of `Vec::shrink_to()` and `IntoIterator` for arrays.
115
ac.emit_rustc_version(1, 56);
126

src/binary_heap.rs

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
//! [dijkstra]: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
1919
//! [sssp]: https://en.wikipedia.org/wiki/Shortest_path_problem
2020
//! [dir_graph]: https://en.wikipedia.org/wiki/Directed_graph
21-
//! [`BinaryHeap`]: struct.BinaryHeap.html
2221
//!
2322
//! ```
2423
//! use std::cmp::Ordering;
@@ -146,8 +145,7 @@
146145
//! }
147146
//! ```
148147
149-
#![cfg_attr(rustc_1_52, deny(unsafe_op_in_unsafe_fn))]
150-
#![cfg_attr(not(rustc_1_52), allow(unused_unsafe))]
148+
#![deny(unsafe_op_in_unsafe_fn)]
151149
#![allow(clippy::needless_doctest_main)]
152150
#![allow(missing_docs)]
153151
// #![stable(feature = "rust1", since = "1.0.0")]
@@ -264,10 +262,10 @@ use std::vec;
264262
/// [`Ord`]: https://doc.rust-lang.org/stable/core/cmp/trait.Ord.html
265263
/// [`Cell`]: https://doc.rust-lang.org/stable/core/cell/struct.Cell.html
266264
/// [`RefCell`]: https://doc.rust-lang.org/stable/core/cell/struct.RefCell.html
267-
/// [push]: #method.push
268-
/// [pop]: #method.pop
269-
/// [peek]: #method.peek
270-
/// [peek\_mut]: #method.peek_mut
265+
/// [push]: BinaryHeap::push
266+
/// [pop]: BinaryHeap::pop
267+
/// [peek]: BinaryHeap::peek
268+
/// [peek\_mut]: BinaryHeap::peek_mut
271269
// #[stable(feature = "rust1", since = "1.0.0")]
272270
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
273271
pub struct BinaryHeap<T, C = MaxComparator> {
@@ -333,8 +331,7 @@ where
333331
/// This `struct` is created by the [`peek_mut`] method on [`BinaryHeap`]. See
334332
/// its documentation for more.
335333
///
336-
/// [`peek_mut`]: struct.BinaryHeap.html#method.peek_mut
337-
/// [`BinaryHeap`]: struct.BinaryHeap.html
334+
/// [`peek_mut`]: BinaryHeap::peek_mut
338335
// #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
339336
pub struct PeekMut<'a, T: 'a, C: 'a + Compare<T>> {
340337
heap: &'a mut BinaryHeap<T, C>,
@@ -1196,7 +1193,7 @@ impl<T, C> BinaryHeap<T, C> {
11961193
/// heap.push(4);
11971194
/// ```
11981195
///
1199-
/// [`reserve`]: #method.reserve
1196+
/// [`reserve`]: BinaryHeap::reserve
12001197
// #[stable(feature = "rust1", since = "1.0.0")]
12011198
pub fn reserve_exact(&mut self, additional: usize) {
12021199
self.data.reserve_exact(additional);
@@ -1468,8 +1465,6 @@ impl<T> Drop for Hole<'_, T> {
14681465
///
14691466
/// This `struct` is created by [`BinaryHeap::iter()`]. See its
14701467
/// documentation for more.
1471-
///
1472-
/// [`BinaryHeap::iter()`]: struct.BinaryHeap.html#method.iter
14731468
#[must_use = "iterators are lazy and do nothing unless consumed"]
14741469
// #[stable(feature = "rust1", since = "1.0.0")]
14751470
pub struct Iter<'a, T: 'a> {
@@ -1536,7 +1531,6 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
15361531
/// This `struct` is created by [`BinaryHeap::into_iter()`]
15371532
/// (provided by the [`IntoIterator`] trait). See its documentation for more.
15381533
///
1539-
/// [`BinaryHeap::into_iter()`]: struct.BinaryHeap.html#method.into_iter
15401534
/// [`IntoIterator`]: https://doc.rust-lang.org/stable/core/iter/trait.IntoIterator.html
15411535
// #[stable(feature = "rust1", since = "1.0.0")]
15421536
#[derive(Clone)]
@@ -1612,8 +1606,6 @@ impl<T, C: Compare<T>> Iterator for IntoIterSorted<T, C> {
16121606
///
16131607
/// This `struct` is created by [`BinaryHeap::drain()`]. See its
16141608
/// documentation for more.
1615-
///
1616-
/// [`BinaryHeap::drain()`]: struct.BinaryHeap.html#method.drain
16171609
// #[stable(feature = "drain", since = "1.6.0")]
16181610
#[derive(Debug)]
16191611
pub struct Drain<'a, T: 'a> {
@@ -1682,11 +1674,6 @@ impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T> {
16821674
}
16831675
}
16841676

1685-
/// # Compatibility
1686-
///
1687-
/// This trait is only implemented for Rust 1.41.0 or greater. For earlier versions, `Into<Vec<T>>`
1688-
/// is implemented for `BinaryHeap<T, C>` instead.
1689-
#[cfg(rustc_1_41)]
16901677
impl<T, C> From<BinaryHeap<T, C>> for Vec<T> {
16911678
/// Converts a `BinaryHeap<T>` into a `Vec<T>`.
16921679
///
@@ -1697,17 +1684,6 @@ impl<T, C> From<BinaryHeap<T, C>> for Vec<T> {
16971684
}
16981685
}
16991686

1700-
#[cfg(not(rustc_1_41))]
1701-
impl<T, C> Into<Vec<T>> for BinaryHeap<T, C> {
1702-
/// Converts a `BinaryHeap<T>` into a `Vec<T>`.
1703-
///
1704-
/// This conversion requires no data movement or allocation, and has
1705-
/// constant time complexity.
1706-
fn into(self) -> Vec<T> {
1707-
self.data
1708-
}
1709-
}
1710-
17111687
// #[stable(feature = "rust1", since = "1.0.0")]
17121688
impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
17131689
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {

0 commit comments

Comments
 (0)