Skip to content
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

refactor!: Remove node parameter from Circuit #824

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aborgna-q
Copy link
Collaborator

The update to hugr 0.15 added a Node associated type to HugrView.
Over here, that got implemented as a new type parameter in Circuit,

struct Circuit<T = Hugr, N = Node>

All impl blocks however restrain it to the specific hugr support,

impl<T: HugrView> Circuit<T, T::Node> { ... }

Given how both types are connected, we should be using T::Node directly since an unrelated node type is not usable here.

This PR changes the definition to

pub struct Circuit<T: HugrView = Hugr>

As this is a breaking change, it can wait until the next breaking release.

BREAKING CHANGE: Removed node type parameter from Circuit

@aborgna-q aborgna-q requested a review from a team as a code owner March 20, 2025 11:18
@aborgna-q aborgna-q requested a review from doug-q March 20, 2025 11:18
Copy link
Contributor

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

Looks great. Not approving because we don't want to merge yet.

Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.58%. Comparing base (9b31135) to head (df8324f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #824   +/-   ##
=======================================
  Coverage   82.58%   82.58%           
=======================================
  Files          65       65           
  Lines        8097     8097           
  Branches     7834     7834           
=======================================
  Hits         6687     6687           
  Misses       1005     1005           
  Partials      405      405           
Flag Coverage Δ
python 82.12% <ø> (ø)
rust 82.60% <100.00%> (ø)

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
Collaborator

hugrbot commented Mar 20, 2025

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary

--- failure type_allows_fewer_generic_type_params: type now allows fewer generic type parameters ---

Description:
A type now allows fewer generic type parameters than it used to. Uses of this type that supplied all previously-supported generic types will be broken.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-parameter-no-default
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/type_allows_fewer_generic_type_params.ron

Failed in:
Struct Circuit allows 2 -> 1 generic types in /home/runner/work/tket2/tket2/PR_BRANCH/tket2/src/circuit.rs:37
Struct Circuit allows 2 -> 1 generic types in /home/runner/work/tket2/tket2/PR_BRANCH/tket2/src/circuit.rs:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants