Skip to content

feat!: Update to hugr 0.26.0#1448

Merged
aborgna-q merged 16 commits intomainfrom
ab/hugr-0.26.0
Mar 19, 2026
Merged

feat!: Update to hugr 0.26.0#1448
aborgna-q merged 16 commits intomainfrom
ab/hugr-0.26.0

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

@aborgna-q aborgna-q commented Mar 16, 2026

Updates the hugr dependencies to 0.26.0, and fixes all the breaking changes.

I only added no-op stubs implementing WithScope for the local passes.
We will add the actual implementation in #1429.

Requires updating LLVM too, so we should merge #1422 into this PR. We also need to delete the now removed stack_array lowering.

BREAKING CHANGE: Updated public hugr dependency to 0.26.0.

Requires a hugr-passes 0.26.1 patch release to include Quantinuum/hugr#2954

Closes #1444

@aborgna-q
Copy link
Copy Markdown
Collaborator Author

Asking for a review before merging the LLVM update from #1422 into this branch.
The compilation error will be fixed there.

@aborgna-q aborgna-q requested a review from cqc-alec March 17, 2026 11:20
Copy link
Copy Markdown
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

BREAKING CHANGE: The hugr-llvm LLVM version is being upgraded to 21.1,
and code that depends on it here needs to be updated as well. This also
includes an MSRV change to 1.91 to match hugr. See [the hugr
PR](Quantinuum/hugr#2901) for details.

Closes #1421

---------

Co-authored-by: Jake Arkinstall <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 81.29252% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.53%. Comparing base (b82a771) to head (400fd43).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
qis-compiler/rust/gpu.rs 53.84% 1 Missing and 11 partials ⚠️
tket-qsystem/src/llvm/array_utils.rs 79.54% 0 Missing and 9 partials ⚠️
tket-qsystem/src/replace_bools.rs 85.71% 3 Missing and 1 partial ⚠️
tket/src/passes/guppy.rs 42.85% 3 Missing and 1 partial ⚠️
tket-qsystem/src/extension/qsystem/lower.rs 70.00% 3 Missing ⚠️
tket-qsystem/src/llvm/debug.rs 72.72% 0 Missing and 3 partials ⚠️
tket-qsystem/src/llvm/result.rs 86.36% 0 Missing and 3 partials ⚠️
tket-qsystem/src/lower_drops.rs 25.00% 3 Missing ⚠️
tket-qsystem/src/replace_bools/static_array.rs 50.00% 3 Missing ⚠️
tket/src/modifier/pass.rs 0.00% 3 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1448      +/-   ##
==========================================
- Coverage   79.65%   79.53%   -0.13%     
==========================================
  Files         155      155              
  Lines       20335    20245      -90     
  Branches    19345    19254      -91     
==========================================
- Hits        16197    16101      -96     
- Misses       3180     3191      +11     
+ Partials      958      953       -5     
Flag Coverage Δ
python 93.00% <ø> (ø)
qis-compiler 93.75% <100.00%> (-6.25%) ⬇️
rust 78.83% <81.22%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hugrbot
Copy link
Copy Markdown
Collaborator

hugrbot commented Mar 17, 2026

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary
    Building tket v0.17.0 (current)
error: running cargo-doc on crate 'tket' failed with output:
-----
 Compiling proc-macro2 v1.0.106
 Compiling quote v1.0.45
 Compiling unicode-ident v1.0.24
 Compiling serde_core v1.0.228
 Compiling libc v0.2.183
 Compiling serde v1.0.228
 Compiling autocfg v1.5.0
 Compiling syn v2.0.117
 Compiling find-msvc-tools v0.1.9
 Compiling shlex v1.3.0
 Compiling jobserver v0.1.34
 Compiling num-traits v0.2.19
 Compiling cc v1.2.57
  Checking once_cell v1.21.4
  Checking either v1.15.0
  Checking memchr v2.8.0
  Checking cfg-if v1.0.4
 Compiling version_check v0.9.5
  Checking hashbrown v0.16.1
  Checking equivalent v1.0.2
 Compiling semver v1.0.27
  Checking indexmap v2.13.0
 Compiling crossbeam-utils v0.8.21
 Compiling pkg-config v0.3.32
 Compiling lazy_static v1.5.0
 Compiling radium v0.7.0
 Compiling anyhow v1.0.102
 Compiling zstd-sys v2.0.16+zstd.1.5.7
 Compiling thiserror v2.0.18
  Checking tap v1.0.1
 Compiling ident_case v1.0.1
 Compiling thiserror v1.0.69
 Compiling ucd-trie v0.1.7
 Compiling unicode-segmentation v1.12.0
 Compiling strsim v0.11.1
 Compiling zmij v1.0.21
 Compiling darling_core v0.23.0
 Compiling convert_case v0.10.0
 Compiling pest v2.8.6
  Checking wyz v0.5.1
 Compiling serde_derive v1.0.228
 Compiling thiserror-impl v1.0.69
 Compiling thiserror-impl v2.0.18
 Compiling getrandom v0.4.2
 Compiling serde_json v1.0.149
  Checking foldhash v0.1.5
 Compiling typeid v1.0.3
  Checking itoa v1.0.17
  Checking funty v2.0.0
 Compiling unicode-xid v0.2.6
 Compiling derive_more-impl v2.1.1
  Checking hashbrown v0.15.5
 Compiling darling_macro v0.23.0
 Compiling pest_meta v2.8.6
  Checking smallvec v1.15.1
  Checking bitvec v1.0.1
  Checking crossbeam-epoch v0.9.18
 Compiling slotmap_fork_lmondada v1.0.8
 Compiling heck v0.5.0
 Compiling paste v1.0.15
 Compiling zerocopy v0.8.42
 Compiling zstd-safe v7.2.4
  Checking pin-project-lite v0.2.17
  Checking fixedbitset v0.5.7
 Compiling ref-cast v1.0.25
 Compiling winnow v1.0.0
 Compiling erased-serde v0.4.10
 Compiling rayon-core v1.13.0
 Compiling convert_case v0.4.0
 Compiling regex-lite v0.1.9
 Compiling derive_more v0.99.20
 Compiling llvm-sys v211.0.0
 Compiling toml_parser v1.0.10+spec-1.1.0
  Checking petgraph v0.8.3
  Checking derive_more v2.1.1
 Compiling strum_macros v0.28.0
  Checking crossbeam-deque v0.8.6
 Compiling pest_generator v2.8.6
 Compiling darling v0.23.0
 Compiling ref-cast-impl v1.0.25
 Compiling serde_derive_internals v0.29.1
 Compiling aho-corasick v1.1.4
 Compiling rustc_version v0.4.1
 Compiling ahash v0.8.12
  Checking itertools v0.14.0
  Checking regex-syntax v0.8.10
 Compiling cgmath v0.18.0
  Checking unicode-width v0.2.2
 Compiling typetag v0.2.21
 Compiling rustix v1.1.4
  Checking arrayvec v0.5.2
  Checking typed-arena v2.0.2
  Checking rustc-hash v2.1.1
 Compiling toml_datetime v1.0.1+spec-1.1.0
  Checking byteorder v1.5.0
  Checking fxhash v0.2.1
 Compiling toml_edit v0.25.5+spec-1.1.0
  Checking pretty v0.12.5
  Checking regex-automata v0.4.14
 Compiling schemars_derive v1.2.1
 Compiling rstest_macros v0.26.1
 Compiling pest_derive v2.8.6
 Compiling serde_with_macros v3.18.0
  Checking strum v0.28.0
  Checking ordered-float v5.1.0
 Compiling derive-where v1.6.1
 Compiling delegate v0.13.5
 Compiling tracing-attributes v0.1.31
 Compiling typetag-impl v0.2.21
  Checking itertools v0.13.0
  Checking tracing-core v0.1.36
  Checking smol_str v0.3.6
  Checking approx v0.4.0
  Checking capnp v0.25.2
  Checking linux-raw-sys v0.12.1
  Checking base64 v0.22.1
 Compiling parking_lot_core v0.9.12
  Checking dyn-clone v1.0.20
  Checking bumpalo v3.20.2
  Checking bitflags v2.11.0
  Checking inventory v0.3.22
  Checking utf8-width v0.1.8
 Compiling syn v1.0.109
  Checking html-escape v0.2.13
  Checking hugr-model v0.26.1
  Checking schemars v1.2.1
  Checking relrc v0.5.0
 Compiling enum_dispatch v0.3.13
  Checking tracing v0.1.44
  Checking portgraph v0.15.3
  Checking serde_with v3.18.0
  Checking rayon v1.11.0
  Checking zstd v0.13.3
 Compiling regex v1.12.3
 Compiling proc-macro-crate v3.5.0
 Compiling futures-macro v0.3.32
 Compiling glob v0.3.3
 Compiling pastey v0.2.1
 Compiling fixedbitset v0.4.2
 Compiling relative-path v1.9.3
  Checking slab v0.4.12
  Checking static_assertions v1.1.0
  Checking scopeguard v1.2.0
  Checking futures-task v0.3.32
  Checking futures-core v0.3.32
 Compiling inkwell v0.8.0
  Checking downcast-rs v2.0.2
  Checking fastrand v2.3.0
  Checking allocator-api2 v0.2.21
  Checking hugr-core v0.26.1
  Checking tempfile v3.27.0
  Checking futures-util v0.3.32
  Checking hashbrown v0.14.5
  Checking lock_api v0.4.14
 Compiling petgraph v0.6.5
error: No suitable version of LLVM was found system-wide or pointed
            to by LLVM_SYS_211_PREFIX.
     
            Consider using `llvmenv` to compile an appropriate copy of LLVM, and
            refer to the llvm-sys documentation for more information.
     
            llvm-sys: https://crates.io/crates/llvm-sys
            llvmenv: https://crates.io/crates/llvmenv
 --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/llvm-sys-211.0.0/src/lib.rs:532:1
  |
532 | / std::compile_error!(concat!(
533 | |     "No suitable version of LLVM was found system-wide or pointed
534 | |        to by LLVM_SYS_",
535 | |     env!("CARGO_PKG_VERSION_MAJOR"),
...   |
542 | |        llvmenv: https://crates.io/crates/llvmenv"
543 | | ));
  | |__^

error: could not compile `llvm-sys` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

-----

error: failed to build rustdoc for crate tket v0.17.0
note: this is usually due to a compilation error in the crate,
    and is unlikely to be a bug in cargo-semver-checks
note: the following command can be used to reproduce the error:
    cargo new --lib example &&
        cd example &&
        echo '[workspace]' >> Cargo.toml &&
        cargo add --path /home/runner/work/tket2/tket2/PR_BRANCH/tket --features binary-eccs,default,llvm,portmatching,rewrite-tracing &&
        cargo check &&
        cargo doc

  Building tket-qsystem v0.23.0 (current)
error: running cargo-doc on crate 'tket-qsystem' failed with output:
-----
 Compiling proc-macro2 v1.0.106
 Compiling unicode-ident v1.0.24
 Compiling quote v1.0.45
 Compiling libc v0.2.183
 Compiling serde_core v1.0.228
 Compiling find-msvc-tools v0.1.9
  Checking once_cell v1.21.4
 Compiling shlex v1.3.0
  Checking cfg-if v1.0.4
 Compiling syn v2.0.117
 Compiling jobserver v0.1.34
 Compiling cc v1.2.57
 Compiling serde v1.0.228
 Compiling autocfg v1.5.0
 Compiling num-traits v0.2.19
 Compiling version_check v0.9.5
 Compiling memchr v2.8.0
 Compiling heck v0.5.0
  Checking either v1.15.0
 Compiling semver v1.0.27
 Compiling equivalent v1.0.2
 Compiling hashbrown v0.16.1
 Compiling crossbeam-utils v0.8.21
 Compiling anyhow v1.0.102
 Compiling pkg-config v0.3.32
 Compiling indexmap v2.13.0
 Compiling lazy_static v1.5.0
 Compiling zstd-sys v2.0.16+zstd.1.5.7
 Compiling ident_case v1.0.1
 Compiling strsim v0.11.1
 Compiling thiserror v2.0.18
  Checking smallvec v1.15.1
 Compiling getrandom v0.4.2
 Compiling unicode-segmentation v1.12.0
 Compiling ucd-trie v0.1.7
  Checking unicode-width v0.2.2
 Compiling zmij v1.0.21
 Compiling pest v2.8.6
 Compiling convert_case v0.10.0
 Compiling darling_core v0.23.0
  Checking foldhash v0.1.5
 Compiling serde_derive v1.0.228
 Compiling thiserror-impl v2.0.18
 Compiling unicode-xid v0.2.6
 Compiling radium v0.7.0
  Checking itoa v1.0.17
 Compiling typeid v1.0.3
 Compiling serde_json v1.0.149
 Compiling darling_macro v0.23.0
 Compiling derive_more-impl v2.1.1
  Checking hashbrown v0.15.5
 Compiling pest_meta v2.8.6
 Compiling slotmap_fork_lmondada v1.0.8
  Checking tracing-core v0.1.36
 Compiling winnow v1.0.0
  Checking pin-project-lite v0.2.17
 Compiling rustix v1.1.4
 Compiling regex-lite v0.1.9
 Compiling zstd-safe v7.2.4
 Compiling thiserror v1.0.69
 Compiling ref-cast v1.0.25
  Checking tap v1.0.1
 Compiling erased-serde v0.4.10
  Checking fixedbitset v0.5.7
  Checking wyz v0.5.1
  Checking petgraph v0.8.3
 Compiling llvm-sys v211.0.0
 Compiling toml_parser v1.0.10+spec-1.1.0
  Checking derive_more v2.1.1
 Compiling pest_generator v2.8.6
 Compiling darling v0.23.0
 Compiling thiserror-impl v1.0.69
 Compiling strum_macros v0.28.0
 Compiling ref-cast-impl v1.0.25
  Checking crossbeam-epoch v0.9.18
 Compiling serde_derive_internals v0.29.1
 Compiling rustc_version v0.4.1
  Checking itertools v0.14.0
  Checking aho-corasick v1.1.4
 Compiling cgmath v0.18.0
  Checking byteorder v1.5.0
  Checking rustc-hash v2.1.1
 Compiling convert_case v0.4.0
 Compiling zerocopy v0.8.42
  Checking bitflags v2.11.0
 Compiling typetag v0.2.21
 Compiling paste v1.0.15
  Checking arrayvec v0.5.2
  Checking regex-syntax v0.8.10
 Compiling rayon-core v1.13.0
  Checking funty v2.0.0
 Compiling toml_datetime v1.0.1+spec-1.1.0
  Checking typed-arena v2.0.2
  Checking linux-raw-sys v0.12.1
  Checking regex-automata v0.4.14
  Checking pretty v0.12.5
 Compiling toml_edit v0.25.5+spec-1.1.0
  Checking bitvec v1.0.1
 Compiling derive_more v0.99.20
  Checking fxhash v0.2.1
  Checking strum v0.28.0
 Compiling schemars_derive v1.2.1
 Compiling rstest_macros v0.26.1
  Checking crossbeam-deque v0.8.6
 Compiling pest_derive v2.8.6
 Compiling serde_with_macros v3.18.0
  Checking ordered-float v5.1.0
 Compiling delegate v0.13.5
 Compiling typetag-impl v0.2.21
 Compiling tracing-attributes v0.1.31
 Compiling derive-where v1.6.1
  Checking approx v0.4.0
  Checking itertools v0.13.0
 Compiling ahash v0.8.12
  Checking smol_str v0.3.6
  Checking utf8-width v0.1.8
  Checking bumpalo v3.20.2
  Checking fastrand v2.3.0
  Checking capnp v0.25.2
  Checking inventory v0.3.22
  Checking utf8parse v0.2.2
  Checking dyn-clone v1.0.20
  Checking base64 v0.22.1
  Checking schemars v1.2.1
  Checking relrc v0.5.0
  Checking anstyle-parse v1.0.0
  Checking tempfile v3.27.0
 Compiling enum_dispatch v0.3.13
  Checking html-escape v0.2.13
  Checking tracing v0.1.44
  Checking portgraph v0.15.3
  Checking hugr-model v0.26.1
  Checking serde_with v3.18.0
  Checking zstd v0.13.3
 Compiling regex v1.12.3
 Compiling proc-macro-crate v3.5.0
 Compiling futures-macro v0.3.32
 Compiling relative-path v1.9.3
 Compiling pastey v0.2.1
  Checking static_assertions v1.1.0
  Checking anstyle-query v1.1.5
 Compiling glob v0.3.3
  Checking colorchoice v1.0.5
  Checking futures-core v0.3.32
  Checking is_terminal_polyfill v1.70.2
  Checking futures-task v0.3.32
  Checking anstyle v1.0.14
  Checking downcast-rs v2.0.2
  Checking slab v0.4.12
 Compiling parking_lot_core v0.9.12
 Compiling inkwell v0.8.0
  Checking futures-util v0.3.32
  Checking anstream v1.0.0
  Checking hugr-core v0.26.1
  Checking rayon v1.11.0
error: No suitable version of LLVM was found system-wide or pointed
            to by LLVM_SYS_211_PREFIX.
     
            Consider using `llvmenv` to compile an appropriate copy of LLVM, and
            refer to the llvm-sys documentation for more information.
     
            llvm-sys: https://crates.io/crates/llvm-sys
            llvmenv: https://crates.io/crates/llvmenv
 --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/llvm-sys-211.0.0/src/lib.rs:532:1
  |
532 | / std::compile_error!(concat!(
533 | |     "No suitable version of LLVM was found system-wide or pointed
534 | |        to by LLVM_SYS_",
535 | |     env!("CARGO_PKG_VERSION_MAJOR"),
...   |
542 | |        llvmenv: https://crates.io/crates/llvmenv"
543 | | ));
  | |__^

error: could not compile `llvm-sys` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

-----

error: failed to build rustdoc for crate tket-qsystem v0.23.0
note: this is usually due to a compilation error in the crate,
    and is unlikely to be a bug in cargo-semver-checks
note: the following command can be used to reproduce the error:
    cargo new --lib example &&
        cd example &&
        echo '[workspace]' >> Cargo.toml &&
        cargo add --path /home/runner/work/tket2/tket2/PR_BRANCH/tket-qsystem --features cli,default,llvm &&
        cargo check &&
        cargo doc

error: aborting due to failure to build rustdoc for crate tket v0.17.0

@aborgna-q
Copy link
Copy Markdown
Collaborator Author

I had to skip the test_llvm set in qis-compiler/python/test/test_basic_generation.py.
They fail with an error about a function not being monomorphized.

I suspect it's due to the pass scope configuration in QSystemPass, but this is not the PR to fix that.
I propose we merge this now, and fix the error in #1429.

@aborgna-q aborgna-q marked this pull request as ready for review March 17, 2026 17:55
@aborgna-q aborgna-q requested a review from a team as a code owner March 17, 2026 17:55
@aborgna-q aborgna-q requested a review from cqc-alec March 17, 2026 17:55
@aborgna-q aborgna-q force-pushed the ab/hugr-0.26.0 branch 4 times, most recently from 7c55c3c to c42afe0 Compare March 18, 2026 13:04
@aborgna-q aborgna-q force-pushed the ab/hugr-0.26.0 branch 5 times, most recently from e4d4905 to cb4d32c Compare March 18, 2026 14:27
@aborgna-q
Copy link
Copy Markdown
Collaborator Author

I disabled the linux ARM qis-compiler builds for now, while we wait for the custom LLVM builds on lower glibc.

I think this should be ready to merge now.

manylinux-aarch64-image = "manylinux_2_28"

# TODO: This has been temporarily bumped to get the tests working after the
# update to LLVM 21. This needs to go back to 'manylinux_2_28' before release.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should make an issue for this if there isn't one already.

// and is the best way to do so.
// This was written when using LLVM14, so we used 3 `feq`s.
//
// TODO: We now use LLVM21. Update this accordingly.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth making a github issue for this?

@aborgna-q aborgna-q added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit f43a877 Mar 19, 2026
30 checks passed
@aborgna-q aborgna-q deleted the ab/hugr-0.26.0 branch March 19, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace use of things deprecated in hugr 0.25.7

4 participants