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

feat!: Support old Composite alias for CustomGate #91

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

aborgna-q
Copy link
Collaborator

Closes #67

BREAKING CHANGE: Renamed circuit_json::CompositeGate to CustomGate

@hugrbot
Copy link
Collaborator

hugrbot commented Nov 13, 2024

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/struct_missing.ron

Failed in:
struct tket_json_rs::circuit_json::CompositeGate, previously in file /home/runner/work/tket-json-rs/tket-json-rs/BASELINE_BRANCH/src/circuit_json.rs:13

@@ -129,10 +129,11 @@ pub enum OpBox {
/// A user-defined assertion specified by a 2x2, 4x4, or 8x8 projector matrix.
ProjectorAssertionBox { id: BoxID, matrix: Matrix },
/// A user-defined gate defined by a parametrised Circuit.
#[serde(alias = "Composite")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be CompositeGate?

@@ -486,6 +486,7 @@ pub enum OpType {
/// See [`CustomGate`]
///
/// [`CustomGate`]: crate::opbox::OpBox::CustomGate
#[serde(alias = "Composite")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be CompositeGate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The optype enum said Composite, but the class was CompositeGate.
https://github.com/CQCL/tket/pull/175/files#diff-76f05b37a15248c7c6dd673f19dc5b8e74829d4d2ae0ad1316c982ab7fd3373fL567-L570
Do you know which one should it be?

I don't have an old json to verify (@johnchildren do you?).
I could also just add both alias.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it was ever called CompositeGate, but I'd have to look through the tket commit history too check. I think it was called Composite with a class of CompositeGate but was then renamed to CustomGate (both op type and class) later from memory.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry yeah see the PR from the issue: https://github.com/CQCL/tket/pull/175/files

It was called Composite and was never called CompositeGate

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, looks like it should match the OpType rather than the class, so Composite is correct.

@aborgna-q aborgna-q added this pull request to the merge queue Nov 13, 2024
Merged via the queue into main with commit dbf513d Nov 13, 2024
8 checks passed
@aborgna-q aborgna-q deleted the ab/composite branch November 13, 2024 14:31
@hugrbot hugrbot mentioned this pull request Nov 13, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
## 🤖 New release
* `tket-json-rs`: 0.6.2 -> 0.7.0 (⚠️ API breaking changes)

### ⚠️ `tket-json-rs` breaking changes

```
--- failure enum_variant_missing: pub enum variant removed or renamed ---

Description:
A publicly-visible enum has at least one variant that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/enum_variant_missing.ron

Failed in:
  variant ClassicalExpUnit::Register, previously in file /tmp/.tmpgK5lkw/tket-json-rs/src/circuit_json.rs:56

--- failure struct_marked_non_exhaustive: struct marked #[non_exhaustive] ---

Description:
A public struct has been marked #[non_exhaustive], which will prevent it from being constructed using a struct literal outside of its crate. It previously had no private fields, so a struct literal could be used to construct it outside its crate.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/struct_marked_non_exhaustive.ron

Failed in:
  struct SerialCircuit in /tmp/.tmp7Vjg5L/tket-json-rs/src/circuit_json.rs:202
  struct SerialCircuit in /tmp/.tmp7Vjg5L/tket-json-rs/src/circuit_json.rs:202

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/struct_missing.ron

Failed in:
  struct tket_json_rs::circuit_json::Bitstring, previously in file /tmp/.tmpgK5lkw/tket-json-rs/src/circuit_json.rs:35
  struct tket_json_rs::circuit_json::BitRegister, previously in file /tmp/.tmpgK5lkw/tket-json-rs/src/circuit_json.rs:25
  struct tket_json_rs::circuit_json::CompositeGate, previously in file /tmp/.tmpgK5lkw/tket-json-rs/src/circuit_json.rs:14
  struct tket_json_rs::circuit_json::Register, previously in file /tmp/.tmpgK5lkw/tket-json-rs/src/circuit_json.rs:10
```

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

### ⚠ BREAKING CHANGES

- Made `SerialCircuit` non exhaustive.
- `Register` renamed to `ElementId`, `Qubit` and `Bit`
- Moved some definitions from `::circuit_json` to `::register`
- Bumped MSRV to rust 1.75
- Renamed `circuit_json::CompositeGate` to `CustomGate`

## 0.7.0 (2024-11-13)

### Features

- [**breaking**] `created/discarded_qubits` circuit attribute
([#87](#87))
- Support classical expressions
([#86](#86))
- [**breaking**] Rename `Register` and cleanup definitions
([#89](#89))
- [**breaking**] Support old `Composite` alias for `CustomGate`
([#91](#91))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com>
@hugrbot hugrbot mentioned this pull request Nov 18, 2024
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.

Handle legacy OpNames for Composite etc
4 participants