Skip to content

Synchronize with Rust 1.62.0 #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fcdcff7
Port some rust-lang/rust performance and safety PRs
clint-white Jul 17, 2022
478bb1f
Adjust lint levels for using unsafe blocks in unsafe fns
clint-white Jul 23, 2022
051c6ec
Port changes in `BinaryHeap::append`
clint-white Jul 24, 2022
d5d672b
Port rust-lang/rust#50487: Use `ManuallyDrop` instead of `Option`
clint-white Jul 17, 2022
4cbae63
Port rust-lang/rust@e70c2fbd: "liballoc: elide some lifetimes"
clint-white Jul 17, 2022
3c1b1f5
Add #[must_use] to many methods
clint-white Jul 17, 2022
3fd3716
Port rust-lang/rust changes for `Iterator`, `Extend`
clint-white Jul 18, 2022
8326532
Port rust-lang/rust documentation changes
clint-white Jul 18, 2022
848c784
Add more links in documentation
clint-white Jul 19, 2022
6e6e244
Use provided methods of `Compare` trait
clint-white Jul 19, 2022
b47dbba
Add additional test from `alloc`
clint-white Jul 23, 2022
9bd3739
Remove license from within source file
clint-white Jul 23, 2022
61eb0e6
Add `shrink_to()` method, stabilized in Rust 1.56.0
clint-white Jul 25, 2022
b3db7f1
Implement `From<BinaryHeap<T, C>>` for `Vec<T>` when possible
clint-white Jul 31, 2022
0e5ce1a
Relax some trait bounds on `BinaryHeap<T, C>`
clint-white Jul 31, 2022
5837ac2
Implement `From<[T; N]>` for `BinaryHeap<T>`
clint-white Jul 31, 2022
ae09fe7
Port updated example from rust-lang/rust
clint-white Aug 6, 2022
722ec58
Update CHANGELOG.md and document compatibility
clint-white Aug 4, 2022
9845c7c
Fix name of `cfg` value
clint-white Sep 15, 2022
851b5f6
Run CI on Rust versions with conditional compilation
clint-white Sep 17, 2022
8f153a3
Increase MSRV to 1.52.0
clint-white Sep 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ jobs:
- macos-latest
rust:
- stable
- 1.36.0 # MSRV (Rust 2018 and dev-dependency `serde_json`)
- 1.52.0 # MSRV
cargo_args:
- ""
- --features serde
include:
# Also test on nightly and Rust versions between MSRV and stable
# where there is conditional compilation
- os: ubuntu-latest
rust: nightly
cargo_args: ""
- os: ubuntu-latest
rust: 1.56.0
cargo_args: ""

runs-on: ${{ matrix.os }}

Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

* `#[must_use]` attribute to many methods, porting and extending several
rust-lang/rust PRs
* Method `shrink_to()` for Rust 1.56.0 and greater, ported from rust-lang/rust
* Implementation of `From<[T; N]>` for `BinaryHeap<T>` for Rust 1.56.0 or
greater, ported from rust-lang/rust#84111
* Links to referenced items in the documenation
* Example of a min-heap, ported from rust-lang/rust#60451
* Documentation of time complexities of several methods, ported from
rust-lang/rust#60952

### Changed

* Bump MSRV (minimum supported rust version) to rust 1.36.0.
* Bump MSRV (minimum supported rust version) to rust 1.52.0.
* Implement `From<BinaryHeap<T, C>>` for `Vec<T>` instead of `Into<Vec<T>>` for
`BinaryHeap<T, C>`
* Port rust-lang/rust#77435 improvement to rebuild heuristic of
`BinaryHeap::append()`
* Use italics with big-O notation in documentation, ported from
rust-lang/rust#71167
* Relax trait bound `C: Compare<T>` on `BinaryHeap<T, C>` struct and certain
methods, in part ported from rust-lang/rust#58421
* Synchronize internal implementation details with
`std::collections::BinaryHeap` in Rust 1.62.0

## [0.4.1] - 2021-01-06

Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ keywords = ["binary", "heap", "priority", "queue"]
categories = ["data-structures", "algorithms", ]
edition = "2018"

[build-dependencies]
autocfg = "1"

[dependencies]
compare = "0.1.0"
serde = { version = "1.0.116", optional = true, features = ["derive"] }
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

![Rust](https://github.com/sekineh/binary-heap-plus-rs/workflows/Rust/badge.svg)

Enhancement over Rust's `std::collections::BinaryHeap`.
Enhancement over Rust's
[`std::collections::BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html).

It supports the following heaps and still maintains backward compatibility.
- Max heap
Expand All @@ -19,14 +20,20 @@ Other notable added methods are:
- `.into_iter_sorted()` which is less-surprising version of `.into_iter()`. The implementation is backported from `std`.
- `.replace_cmp()` which replace the comparator of the existing heap.

## MSRV (Minimum Supported Rust Version)
## Compatibility and MSRV (Minimum Supported Rust Version)

This crate requires Rust 1.36.0 or later.
This crate is based on the standard library's implementation of
[`BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html)
from Rust 1.62.0.

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

# Changes

See CHANGELOG.md.
https://github.com/sekineh/binary-heap-plus-rs/blob/master/CHANGELOG.md
See
[CHANGELOG.md](https://github.com/sekineh/binary-heap-plus-rs/blob/master/CHANGELOG.md).

# Thanks

Expand Down
8 changes: 8 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
let ac = autocfg::new();

// Required for stabilization of `Vec::shrink_to()` and `IntoIterator` for arrays.
ac.emit_rustc_version(1, 56);

autocfg::rerun_path("build.rs");
}
Loading