Skip to content

feat!: Remove extension sets from hugr-core. #2081

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

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

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Apr 15, 2025

This PR removes (runtime) extension sets from hugr-core and hugr-py (see #1906).

BREAKING CHANGE: Functions that manipulate runtime extension sets have been removed from the Rust and Python code. Extension set parameters were removed from operations.

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 84.86239% with 33 lines in your changes missing coverage. Please review.

Project coverage is 82.76%. Comparing base (8ef4afb) to head (f16df5a).

Files with missing lines Patch % Lines
hugr-core/src/builder/circuit.rs 75.00% 0 Missing and 5 partials ⚠️
hugr-core/src/builder/dataflow.rs 57.14% 0 Missing and 3 partials ⚠️
hugr-core/src/hugr/rewrite/replace.rs 57.14% 3 Missing ⚠️
hugr-core/src/hugr/validate/test.rs 86.95% 0 Missing and 3 partials ⚠️
hugr-core/src/builder/cfg.rs 66.66% 0 Missing and 2 partials ⚠️
hugr-core/src/builder/tail_loop.rs 33.33% 0 Missing and 2 partials ⚠️
hugr-core/src/hugr/rewrite/simple_replace.rs 33.33% 0 Missing and 2 partials ⚠️
hugr-core/src/hugr/serialize/test.rs 66.66% 0 Missing and 2 partials ⚠️
hugr-core/src/hugr/views/sibling_subgraph.rs 77.77% 0 Missing and 2 partials ⚠️
hugr-core/src/builder/conditional.rs 80.00% 0 Missing and 1 partial ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2081      +/-   ##
==========================================
- Coverage   83.09%   82.76%   -0.33%     
==========================================
  Files         219      219              
  Lines       41910    41004     -906     
  Branches    37985    37105     -880     
==========================================
- Hits        34825    33937     -888     
+ Misses       5274     5249      -25     
- Partials     1811     1818       +7     
Flag Coverage Δ
python 85.73% <ø> (+0.03%) ⬆️
rust 82.45% <84.86%> (-0.38%) ⬇️

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 Apr 15, 2025

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary

--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/feature_missing.ron

Failed in:
feature extension_inference in the package's Cargo.toml

--- failure enum_no_repr_variant_discriminant_changed: enum variant had its discriminant change value ---

Description:
The enum's variant had its discriminant value change. This breaks downstream code that used its value via a numeric cast like `as isize`.
      ref: https://doc.rust-lang.org/reference/items/enumerations.html#assigning-discriminant-values
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_no_repr_variant_discriminant_changed.ron

Failed in:
variant TypeArg::Variable 5 -> 4 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:185
variant TypeArg::Variable 5 -> 4 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:185

--- 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.41.0/src/lints/enum_variant_missing.ron

Failed in:
variant TypeParam::Extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:98
variant TypeArg::Extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:192
variant TypeArg::Extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:192

--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/feature_missing.ron

Failed in:
feature extension_inference in the package's Cargo.toml

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

Failed in:
FuncTypeBase::with_extension_delta, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/signature.rs:59
FuncTypeBase::with_prelude, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/signature.rs:65
CFGBuilder::block_builder_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/cfg.rs:216
CFGBuilder::entry_builder_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/cfg.rs:303
CFGBuilder::simple_entry_builder_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/cfg.rs:343
OpaqueValue::extension_reqs, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/constant.rs:301
Hugr::validate_no_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/validate.rs:52
Hugr::validate_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/validate.rs:58
Hugr::infer_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr.rs:135
Hugr::validate_no_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/validate.rs:52
Hugr::validate_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/validate.rs:58
Hugr::infer_extensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr.rs:135
ExtensionSet::insert_type_var, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:818
ExtensionSet::type_var, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:849
DFGWrapper::new_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/cfg.rs:427
DFGWrapper::new_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/tail_loop.rs:87
ConditionalBuilder::new_exts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/conditional.rs:167
Value::extension_reqs, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/constant.rs:527
Value::extension_reqs, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/constant.rs:527

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/method_parameter_count_changed.ron

Failed in:
hugr_core::std_extensions::collections::array::ArrayRepeat::new now takes 2 parameters instead of 3, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/std_extensions/collections/array/array_repeat.rs:110
hugr_core::ops::constant::CustomSerialized::new now takes 2 parameters instead of 3, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/ops/constant/custom.rs:199
hugr_core::std_extensions::collections::array::ArrayScan::new now takes 4 parameters instead of 5, in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/std_extensions/collections/array/array_scan.rs:147

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing or renamed
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/pub_module_level_const_missing.ron

Failed in:
TO_BE_INFERRED in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:804

--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---

Description:
A publicly-visible struct has at least one public field 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.41.0/src/lints/struct_pub_field_missing.ron

Failed in:
field extension_delta of struct DataflowBlock, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:177
field extension_delta of struct DataflowBlock, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:177
field runtime_reqs of struct FuncTypeBase, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/signature.rs:41
field extension_reqs of struct ArrayRepeat, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/std_extensions/collections/array/array_repeat.rs:113
field extension_delta of struct TailLoop, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:24
field extension_delta of struct TailLoop, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:24
field extension_reqs of struct ArrayScan, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/std_extensions/collections/array/array_scan.rs:149
field extension_delta of struct Conditional, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:101
field extension_delta of struct Conditional, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/controlflow.rs:101

--- 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.41.0/src/lints/trait_method_missing.ron

Failed in:
method extension_reqs of trait CustomConst, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/constant/custom.rs:69
method validate_no_extensions of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:477
method validate_no_extensions of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:477
method validate_no_extensions of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:477
method cfg_builder_exts of trait Dataflow, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/build_traits.rs:359
method tail_loop_builder_exts of trait Dataflow, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/build_traits.rs:479
method conditional_builder_exts of trait Dataflow, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/builder/build_traits.rs:539

--- 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.41.0/src/lints/enum_variant_added.ron

Failed in:
variant ValidationLevel:Validate in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-passes/src/validation.rs:20

--- 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.41.0/src/lints/enum_variant_missing.ron

Failed in:
variant ValidationLevel::WithoutExtensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-passes/src/validation.rs:21
variant ValidationLevel::WithExtensions, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-passes/src/validation.rs:23

--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/feature_missing.ron

Failed in:
feature extension_inference in the package's Cargo.toml

@zrho zrho force-pushed the zrho/ext-set-core branch from 24d699f to 2918f65 Compare April 17, 2025 15:51
Copy link

codspeed-hq bot commented Apr 17, 2025

CodSpeed Performance Report

Merging #2081 will improve performances by 18.65%

Comparing zrho/ext-set-core (f16df5a) with main (8ef4afb)

Summary

⚡ 6 improvements
✅ 15 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
simple_cfg 179.1 µs 151.8 µs +17.99%
simple_dfg 50.8 µs 42.8 µs +18.65%
circuit_roundtrip/json[1000] 136.6 ms 124 ms +10.11%
circuit_serialize/json[1000] 34.6 ms 31.3 ms +10.63%
circuit_serialize/json[100] 3.7 ms 3.2 ms +16.81%
circuit_serialize/json[10] 405.3 µs 365.5 µs +10.89%

@zrho zrho marked this pull request as ready for review April 22, 2025 12:03
@zrho zrho requested a review from a team as a code owner April 22, 2025 12:03
@zrho zrho requested a review from croyzor April 22, 2025 12:03
@zrho zrho force-pushed the zrho/ext-set-core branch from fee3d9b to 891794a Compare April 22, 2025 12:05
@ss2165 ss2165 added this to the hugr-rs 0.16 milestone Apr 22, 2025
@doug-q doug-q added the breaking-change Changes that break semver label Apr 23, 2025
@zrho zrho force-pushed the zrho/ext-set-core branch from 891794a to cc937c8 Compare April 24, 2025 13:07
@zrho zrho force-pushed the zrho/ext-set-core branch from 1231e57 to f16df5a Compare April 25, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes that break semver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants