Qiskit / rustworkx

A high performance Python graph library implemented in Rust.
https://www.rustworkx.org
Apache License 2.0
1.06k stars 146 forks source link

Compilation error #744

Closed ssokolen closed 1 year ago

ssokolen commented 1 year ago

Information

What is the current behavior?

Rust crate fails to compile as a dependency with the following error:

[...]/rustworkx-core/src/connectivity/min_cut.rs:56:13 | 56 | / pq.change_priority_by(&edge.target(), |x| { 57 | | *x += edge_cost(edge); 58 | | }) | | ^- help: consider using a semicolon here: ; | |__| | expected (), found bool

What is the expected behavior?

The crate should compile as a dependency with no errors.

Steps to reproduce the problem

Add rustwork-core as a dependency in Cargo.toml:

rustworkx-core = "0.12"

I can catch the same issue if I clone the master branch and add it to Cargo.toml by path but not if I compile rustworkx-core on its own. So there might be some something weird with the exports? Regardless, adding a semicolon makes the error go away, but I didn't trace the issue to see if there is anything deeper happening.

mtreinish commented 1 year ago

I expect this is an issue with priorty-queue 1.3.0. They had an api change in that release which was causing this error with the semicolon. However, priority queue 1.3.0 isn't compatible with rustworkx-core's msrv (1.48 in 0.12.x and 1.56 on main). If you pin the priority queue version to < 1.3.0 it should compile.

That being said I tested adding a semi-colon with priority queue 1.2.0 just now and everything still works. So I'm going to push up a PR now to add this and mark it for inclusion in the upcoming 0.12.1 release.

ssokolen commented 1 year ago

Ok, yes, it seems like me adding priority-queue = "=1.2.3" to my own Cargo.toml file fixes the issue without having to resort to an offline clone. That'll work until I can update to "0.12.1".

Thanks for the quick response!

mtreinish commented 1 year ago

Just a heads up, I just tagged and release 0.12.1 and it's live on crates.io now: https://crates.io/crates/rustworkx-core/0.12.1