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

fix: determine correct bounds of custom types #1888

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Jan 21, 2025

Import now determines the bound of the custom type correctly.

Fixes #1876.

@hugrbot
Copy link
Collaborator

hugrbot commented Jan 21, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary

--- 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.38.0/src/lints/auto_trait_impl_removed.ron

Failed in:
type DescendantsGraph is no longer Sync, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/hugr/views/descendants.rs:28
type DescendantsGraph is no longer Sync, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/hugr/views/descendants.rs:28

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.38.0/src/lints/enum_variant_added.ron

Failed in:
variant ImportError:ExtensionType in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/import.rs:57

--- 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.38.0/src/lints/auto_trait_impl_removed.ron

Failed in:
type LLVMSumValue is no longer UnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:181
type LLVMSumValue is no longer RefUnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:181
type LLVMSumType is no longer UnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:32
type LLVMSumType is no longer RefUnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:32
type LLVMSumType is no longer UnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:32
type LLVMSumType is no longer RefUnwindSafe, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-llvm/src/sum.rs:32

--- 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.38.0/src/lints/function_missing.ron

Failed in:
function hugr_llvm::sum::elidable_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:24

--- 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.38.0/src/lints/inherent_method_missing.ron

Failed in:
LLVMSumValue::get_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:529
LLVMSumValue::tag_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:672
LLVMSumValue::num_variants, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:674
LLVMSumType::value_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:96
LLVMSumType::tag_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:98
LLVMSumType::num_variants, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:100
LLVMSumType::num_fields_for_variant, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:103
LLVMSumType::fields_for_variant, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:106
LLVMSumType::try_from_hugr_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:115
LLVMSumType::value, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:168
LLVMSumType::value_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:96
LLVMSumType::tag_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:98
LLVMSumType::num_variants, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:100
LLVMSumType::num_fields_for_variant, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:103
LLVMSumType::fields_for_variant, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:106
LLVMSumType::try_from_hugr_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:115
LLVMSumType::value, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-llvm/src/sum.rs:168

--- failure enum_missing: pub enum removed or renamed ---

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

Failed in:
enum hugr_passes::RemoveDeadFuncsError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-passes/src/dead_funcs.rs:20

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.54%. Comparing base (b38a2e8) to head (5786561).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/import.rs 60.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1888      +/-   ##
==========================================
+ Coverage   86.52%   86.54%   +0.01%     
==========================================
  Files         194      195       +1     
  Lines       35250    35591     +341     
  Branches    32063    32404     +341     
==========================================
+ Hits        30501    30803     +302     
- Misses       2973     3014      +41     
+ Partials     1776     1774       -2     
Flag Coverage Δ
python 92.34% <ø> (ø)
rust 85.97% <60.00%> (+0.02%) ⬆️

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.

@zrho zrho marked this pull request as ready for review January 21, 2025 11:38
@zrho zrho requested a review from a team as a code owner January 21, 2025 11:38
@zrho zrho requested a review from cqc-alec January 21, 2025 11:38
Copy link
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.

Checked that the test in https://github.com/CQCL/hugr/tree/doug/bounds-bug now does not panic. LGTM.

@zrho zrho added this pull request to the merge queue Jan 22, 2025
Merged via the queue into main with commit f7eab22 Jan 22, 2025
22 of 24 checks passed
@zrho zrho deleted the zrho/fix-import-custom-type-bound branch January 22, 2025 10:24
@hugrbot hugrbot mentioned this pull request Jan 21, 2025
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.

hugr-model: panic while round-tripping export/import
3 participants