Skip to content

Use rust-native error for DisjointLayout#16305

Open
raynelfss wants to merge 3 commits into
Qiskit:mainfrom
raynelfss:use-disjoint-layout-error
Open

Use rust-native error for DisjointLayout#16305
raynelfss wants to merge 3 commits into
Qiskit:mainfrom
raynelfss:use-disjoint-layout-error

Conversation

@raynelfss
Copy link
Copy Markdown
Contributor

The following commits modify DisjointLayout to use rust-native errors throughout its pipeline, specifically on its distribute_components method.
We implement the DisjointLayoutError enumeration which derives from DAGError and implements two variants:

  • MultiQEncountered for when the interaction graph finds a multiqubit operation;
  • MismatchedComponentSize for when the circuit and the coupling map have components of differing sizes.

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code:

The following commits modify `DisjointLayout` to use rust-native errors throughout its pipeline, specifically on its `distribute_components` method.
We implement the `DisjointLayoutError` enumeration which derives from `DAGError`; and implements two variants: `MultiQEncountered` for when the interaction graph finds a multiqubit operation; `MismatchedComponentSize`  for when the circuit and the coupling map have components of differing sizes.
@raynelfss raynelfss added this to the 2.5.0 milestone May 28, 2026
@raynelfss raynelfss requested a review from a team as a code owner May 28, 2026 15:26
@raynelfss raynelfss requested a review from Cryoris May 28, 2026 15:26
@raynelfss raynelfss added Changelog: None Do not include in the GitHub Release changelog. Rust This PR or issue is related to Rust code in the repository mod: transpiler Issues and PRs related to Transpiler labels May 28, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

Comment thread crates/transpiler/src/passes/disjoint_layout.rs Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented May 28, 2026

Coverage Report for CI Build 26653406134

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage decreased (-0.1%) to 87.523%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (23 of 26 lines covered, 88.46%).
  • 387 coverage regressions across 11 files.

Uncovered Changes

File Changed Covered %
crates/transpiler/src/passes/disjoint_layout.rs 26 23 88.46%

Coverage Regressions

387 previously-covered lines in 11 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
crates/bindgen-cli/src/abi.rs 210 0.0%
qiskit/synthesis/unitary/qsd.py 82 23.65%
crates/bindgen-cli/src/main.rs 28 0.0%
qiskit/transpiler/preset_passmanagers/builtin_plugins.py 20 95.05%
crates/qasm2/src/parse.rs 12 97.15%
crates/transpiler/src/passes/barrier_before_final_measurement.rs 11 89.62%
crates/bindgen/src/simple_ir.rs 9 70.97%
crates/transpiler/src/passes/convert_to_pauli_rotations.rs 7 95.54%
crates/qasm2/src/lex.rs 5 91.52%
crates/transpiler/src/passes/substitute_pi4_rotations.rs 2 96.06%

Coverage Stats

Coverage Status
Relevant Lines: 123932
Covered Lines: 108469
Line Coverage: 87.52%
Coverage Strength: 964190.38 hits per line

💛 - Coveralls

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Cryoris
Cryoris previously approved these changes May 29, 2026
Comment thread crates/transpiler/src/passes/disjoint_layout.rs Outdated
@Cryoris Cryoris dismissed their stale review May 29, 2026 09:56

Forgot to adjust the Py-conversion of the added text

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: None Do not include in the GitHub Release changelog. mod: transpiler Issues and PRs related to Transpiler Rust This PR or issue is related to Rust code in the repository

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

4 participants