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 tket2.rotation.from_halfturns_unchecked #133

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

doug-q
Copy link
Collaborator

@doug-q doug-q commented Oct 21, 2024

Closes #132

BREAKING CHANGE: PreludeCodegen::emit_panic now takes a single configurable value.

BREAKING CHANGE: `PreludeCodegen::emit_panic` now takes a single
configurable value.
@doug-q doug-q requested a review from a team as a code owner October 21, 2024 07:15
@doug-q doug-q requested a review from croyzor October 21, 2024 07:15
@doug-q doug-q requested a review from mark-koch October 21, 2024 09:54
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 78.28283% with 43 lines in your changes missing coverage. Please review.

Project coverage is 84.96%. Comparing base (ce14684) to head (8960515).

Files with missing lines Patch % Lines
src/extension/rotation.rs 76.76% 6 Missing and 27 partials ⚠️
src/extension/prelude.rs 82.14% 1 Missing and 9 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
- Coverage   85.13%   84.96%   -0.17%     
==========================================
  Files          31       31              
  Lines        4238     4318      +80     
  Branches     4238     4318      +80     
==========================================
+ Hits         3608     3669      +61     
- Misses        305      310       +5     
- Partials      325      339      +14     
Flag Coverage Δ
rust 84.96% <78.28%> (-0.17%) ⬇️

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.

Comment on lines +32 to +33
/// A `RotationCodegenExtension` carries a `PCG`, which should impl
/// [PreludeCodegen]. This is used to [PreludeCodegen::emit_panic] when lowering panicking ops.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we get the prelude codegen from the context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not easily. The context has a collections of "erased" extensions, they are unnamed. They will usually contain a prelude::PreludeCodegenExtension extension, but this is not required. So it might not be there, and even if it is we don't have a way to ask for it.

@doug-q doug-q added this pull request to the merge queue Oct 21, 2024
Merged via the queue into main with commit 9e55d9a Oct 21, 2024
10 checks passed
@doug-q doug-q deleted the doug/from_halfturns_unchecked branch October 21, 2024 12:36
@hugrbot hugrbot mentioned this pull request Oct 21, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 21, 2024
## 🤖 New release
* `hugr-llvm`: 0.5.1 -> 0.6.0 (⚠️ API breaking changes)

### ⚠️ `hugr-llvm` breaking changes

```
--- failure auto_trait_impl_removed: auto trait no longer implemented ---

Description:
A public type has stopped implementing one or more auto traits. This can break downstream code that depends on the traits being implemented.
        ref: https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/auto_trait_impl_removed.ron

Failed in:
  type TypeConverter is no longer UnwindSafe, in /tmp/.tmpGjujM0/hugr-llvm/src/types.rs:59
  type TypeConverter is no longer RefUnwindSafe, in /tmp/.tmpGjujM0/hugr-llvm/src/types.rs:59

--- failure derive_trait_impl_removed: built-in derived trait no longer implemented ---

Description:
A public type has stopped deriving one or more traits. This can break downstream code that depends on those types implementing those traits.
        ref: https://doc.rust-lang.org/reference/attributes/derive.html#derive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/derive_trait_impl_removed.ron

Failed in:
  type TypeConverter no longer derives Copy, in /tmp/.tmpGjujM0/hugr-llvm/src/types.rs:59
  type TypeConverter no longer derives Clone, in /tmp/.tmpGjujM0/hugr-llvm/src/types.rs:59
  type TypeConverter no longer derives Debug, in /tmp/.tmpGjujM0/hugr-llvm/src/types.rs:59

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function 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/function_missing.ron

Failed in:
  function hugr_llvm::custom::prelude::array::emit_array_op, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude/array.rs:51
  function hugr_llvm::custom::int::add_int_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/int.rs:226
  function hugr_llvm::custom::rotation::add_rotation_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/rotation.rs:196
  function hugr_llvm::custom::prelude::add_prelude_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:295
  function hugr_llvm::custom::float::add_float_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/float.rs:186
  function hugr_llvm::custom::conversions::add_conversions_extension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/conversions.rs:270
  function hugr_llvm::custom::logic::add_logic_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/logic.rs:106
  function hugr_llvm::custom::prelude::add_default_prelude_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:304

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn 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/inherent_method_missing.ron

Failed in:
  TypeConverter::new, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/types.rs:107
  TypeConverter::iw_context, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/types.rs:112
  CodegenExtsMap::add_float_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/float.rs:192
  CodegenExtsMap::add_int_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/int.rs:234
  CodegenExtsMap::add_logic_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/logic.rs:113
  CodegenExtsMap::add_default_prelude_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:311
  CodegenExtsMap::add_prelude_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:317
  CodegenExtsMap::add_rotation_extensions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/rotation.rs:201
  CodegenExtsMap::new, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:88
  CodegenExtsMap::add_cge, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:97
  CodegenExtsMap::get, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:110
  CodegenExtsMap::llvm_type, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:120
  CodegenExtsMap::emit, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:130
  CodegenExtsMap::load_constant, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:145

--- failure module_missing: pub module removed or renamed ---

Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
        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/module_missing.ron

Failed in:
  mod hugr_llvm::custom::conversions, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/conversions.rs:1
  mod hugr_llvm::custom::logic, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/logic.rs:1
  mod hugr_llvm::custom::int, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/int.rs:1
  mod hugr_llvm::custom::prelude, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:1
  mod hugr_llvm::fat, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/fat.rs:1
  mod hugr_llvm::custom::float, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/float.rs:1
  mod hugr_llvm::custom::rotation, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/rotation.rs:1
  mod hugr_llvm::custom::prelude::array, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude/array.rs:1

--- 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 hugr_llvm::custom::logic::LogicCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/logic.rs:78
  struct hugr_llvm::fat::FatNode, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/fat.rs:28
  struct hugr_llvm::custom::int::IntOpsCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/int.rs:120
  struct hugr_llvm::custom::prelude::PreludeCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:174
  struct hugr_llvm::custom::float::FloatTypesCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/float.rs:27
  struct hugr_llvm::emit::NullEmitLlvm, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/emit.rs:52
  struct hugr_llvm::custom::conversions::ConversionsCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/conversions.rs:244
  struct hugr_llvm::custom::prelude::DefaultPreludeCodegen, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:169
  struct hugr_llvm::custom::int::IntTypesCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/int.rs:150
  struct hugr_llvm::custom::rotation::RotationCodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/rotation.rs:30

--- failure trait_method_added: pub trait method added ---

Description:
A non-sealed public trait added a new method without a default implementation, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/trait_method_added.ron

Failed in:
  trait method hugr_llvm::custom::CodegenExtension::add_extension in file /tmp/.tmpGjujM0/hugr-llvm/src/custom.rs:41

--- failure trait_method_missing: pub trait method removed or renamed ---

Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#major-any-change-to-trait-item-signatures
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/trait_method_missing.ron

Failed in:
  method extension of trait CodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:38
  method supported_consts of trait CodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:44
  method llvm_type of trait CodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:50
  method emitter of trait CodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:58
  method load_constant of trait CodegenExtension, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom.rs:68

--- failure trait_missing: pub trait removed or renamed ---

Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait 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/trait_missing.ron

Failed in:
  trait hugr_llvm::emit::EmitOp, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/emit.rs:45
  trait hugr_llvm::custom::prelude::PreludeCodegen, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/custom/prelude.rs:52
  trait hugr_llvm::fat::FatExt, previously in file /tmp/.tmpu0X9jI/hugr-llvm/src/fat.rs:313

--- failure trait_no_longer_object_safe: trait no longer object safe ---

Description:
Trait is no longer object safe, which breaks `dyn Trait` usage.
        ref: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/trait_no_longer_object_safe.ron

Failed in:
  trait CodegenExtension in file /tmp/.tmpGjujM0/hugr-llvm/src/custom.rs:38
```

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

<blockquote>

## [0.6.0](v0.5.1...v0.6.0) -
2024-10-21

### Bug Fixes

- Conversion operations having poison results
([#131](#131))

### New Features

- [**breaking**] Allow extension callbacks to have non-`'static`
lifetimes ([#128](#128))
- [**breaking**] Support `tket2.rotation.from_halfturns_unchecked`
([#133](#133))

### Refactor

- [**breaking**] remove trait emit op
([#104](#104))
- [**breaking**] rework extensions interface
([#119](#119))
- [**breaking**] move packaged extensions from `crate::custom` to
`crate::extension` ([#126](#126))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
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.

Add support for the new from_halfturns_unchecked op in tket2.rotations
3 participants