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

Closed
wants to merge 21 commits into from
Closed

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.

Closes #1906

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 83.99366% with 303 lines in your changes missing coverage. Please review.

Project coverage is 83.05%. Comparing base (c8090ca) to head (da4b16e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/hugr/views/sibling.rs 62.75% 53 Missing and 1 partial ⚠️
hugr-core/src/hugr/patch/replace.rs 70.45% 32 Missing and 7 partials ⚠️
hugr-core/src/hugr/views/impls.rs 43.75% 36 Missing ⚠️
hugr-core/src/hugr/patch.rs 10.34% 26 Missing ⚠️
hugr-core/src/hugr/views/descendants.rs 69.49% 15 Missing and 3 partials ⚠️
hugr-passes/src/composable.rs 91.32% 11 Missing and 4 partials ⚠️
hugr-passes/src/replace_types.rs 92.72% 6 Missing and 6 partials ⚠️
hugr-llvm/src/emit/ops.rs 61.90% 1 Missing and 7 partials ⚠️
hugr-core/src/hugr/views.rs 94.30% 7 Missing ⚠️
hugr-core/src/ops.rs 0.00% 7 Missing ⚠️
... and 34 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2081      +/-   ##
==========================================
- Coverage   83.09%   83.05%   -0.04%     
==========================================
  Files         219      219              
  Lines       41918    41112     -806     
  Branches    37993    37260     -733     
==========================================
- Hits        34830    34146     -684     
+ Misses       5278     5168     -110     
+ Partials     1810     1798      -12     
Flag Coverage Δ
python 85.69% <72.72%> (-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.

🚀 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 model_unstable in the package's Cargo.toml
feature hugr-model in the package's Cargo.toml
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 hugr-model in the package's Cargo.toml
feature model_unstable in the package's Cargo.toml
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
Extension::add_requirements, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:667
Extension::add_requirements, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:667
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 runtime_reqs of struct Extension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:582
field runtime_reqs of struct Extension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/extension.rs:582
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 extension_delta of trait OpTrait, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops.rs:389
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

aborgna-q and others added 9 commits April 15, 2025 13:52
`insert_hugr`, `insert_from_view`, and `insert_subgraph` were written
before we made `Node` a type generic, and incorrectly assumed the return
type maps were always `hugr::Node`s.

The methods were either unusable or incorrect when using generic
`HugrView`s source/targets with non-base node types.

This PR fixes that, and additionally allows us us to have
`SiblingSubgraph::extract_subgraph` work for generic `HugrViews`.

BREAKING CHANGE: Added Node type parameters to extraction operations in
`HugrMut`.
`HugrMutInternals` is part of the semi-private traits defined in
`hugr-core`.
While most things get re-exported in `hugr`, we `*Internal` traits
require you to explicitly declare a dependency on the `-core` package
(as we don't want most users to have to interact with them).

For some reason there was a public re-export of the trait in a
re-exported module, so it ended up appearing in `hugr` anyways.

BREAKING CHANGE: Removed public re-export of `HugrMutInternals` from
`hugr`.
#2027 ended up being breaking due to adding a new variant to an error
enum missing the `non_exhaustive` marker.

This (breaking) PR makes sure all error enums have the flag.

BREAKING CHANGE: Marked all Error enums as `non_exhaustive`
* PartialValue now has a LoadedFunction variant, created by LoadFunction nodes (only, although other analyses are able to create PartialValues if they want)
* This requires adding a type parameter to PartialValue for the type of Node, which gets everywhere :-(.
* Use this to handle CallIndirects *with known targets* (it'll be a single known target or none at all) just like other Calls to the same function
* deprecate (and ignore) `value_from_function`
* Add a new trait `AsConcrete` for the result type of `PartialValue::try_into_concrete` and `PartialSum::try_into_sum`

Note almost no change to constant folding (only to drop impl of `value_from_function`)

BREAKING CHANGE: in dataflow framework, PartialValue now has additional variant; `try_into_concrete` requires the target type to implement AsConcrete.
Adds a generic node type to the `NodeHandle` type.

This is a required change for #2029.

drive-by: Implement the "Link the NodeHandles to the OpType" TODO
Closes #1595

BREAKING CHANGE: `values` field in `Extension` and `ExtensionValue`
struct/class removed in rust and python. Use 0-input ops that return
constant values.
@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 20.17%

Comparing zrho/ext-set-core (da4b16e) with main (7a95561)

Summary

⚡ 7 improvements
✅ 14 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
simple_cfg 179 µs 149.1 µs +20.02%
simple_dfg 50.6 µs 42.1 µs +20.17%
circuit_roundtrip/json[1000] 136.5 ms 123.6 ms +10.47%
circuit_roundtrip/json[10] 1.4 ms 1.3 ms +10.19%
circuit_serialize/json[1000] 34.6 ms 30.6 ms +13.25%
circuit_serialize/json[100] 3.7 ms 3.2 ms +17.23%
circuit_serialize/json[10] 405.9 µs 368.3 µs +10.2%

@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
Currently We have several "passes": monomorphization, dead function
removal, constant folding. Each has its own code to allow setting a
validation level (before and after that pass).

This PR adds the ability chain (sequence) passes;, and to add validation
before+after any pass or sequence; and commons up validation code. The
top-level `constant_fold_pass` (etc.) functions are left as wrappers
that do a single pass with validation only in test.

I've left ConstFoldPass as always including DCE, but an alternative
could be to return a sequence of the two - ATM that means a tuple
`(ConstFoldPass, DeadCodeElimPass)`.

I also wondered about including a method `add_entry_point` in
ComposablePass (e.g. for ConstFoldPass, that means `with_inputs` but no
inputs, i.e. all Top). I feel this is not applicable to *all* passes,
but near enough. This could be done in a later PR but `add_entry_point`
would need a no-op default for that to be a non-breaking change. So if
we wouldn't be happy with the no-op default then I could just add it
here...

Finally...docs are extremely minimal ATM (this is hugr-passes), I am
hoping that most of this is reasonably obvious (it doesn't really do a
lot!), but please flag anything you think is particularly in need of a
doc comment!

BREAKING CHANGE: quite a lot of calls to current pass routines will
break, specific cases include (a) `with_validation_level` should be done
by wrapping a ValidatingPass around the receiver; (b) XXXPass::run()
requires `use ...ComposablePass` (however, such calls will cease to do
any validation).

closes #1832
@doug-q doug-q added the breaking-change Changes that break semver label Apr 23, 2025
acl-cqc and others added 3 commits April 23, 2025 09:55
…eady in the Hugr (#2094)

There are two issues:
* Errors. The previous NodeTemplates still always work, but the Call one
can fail if the Hugr doesn't contain the target function node. ATM there
is no channel for reporting that error so I've had to panic. Otherwise
it's an even-more-breaking change to add an error type to
`NodeTemplate::add()` and `NodeTemplate::add_hugr()`. Should we? (I note
`HugrMut::connect` panics if the node isn't there, but could make the
`NodeTemplate::add` builder method return a BuildError...and propagate
that everywhere of course)
* There's a big limitation in `linearize_array` that it'll break if the
*element* says it should be copied/discarded via a NodeTemplate::Call,
as `linearize_array` puts the elementwise copy/discard function into a
*nested Hugr* (`Value::Function`) that won't contain the function. This
could be fixed via lifting those to toplevel FuncDefns with
name-mangling, but I'd rather leave that for #2086 ....

BREAKING CHANGE: Add new variant NodeTemplate::Call; LinearizeError no
longer derives Eq.
- Allows `HugrMut` to be implemented for `HugrView`s with arbitrary node
types
- Removes `HugrMutInternals::hugr_mut(&mut self) -> &mut Hugr`, it can
be implemented for more complex types. This is required for #1926, but I
haven't touched the read-only side yet.
- Added a `Node` associated type to `Rewrite`. All existing rewrites
only implement `Rewrite<Node = Node>` for now, expanding their type is
left for a separate PR.

drive-by: Fix a couple bugs in rewrite implementations that assumed that
`SiblingMut` contained transitive children.

BREAKING CHANGE: `HugrMut` is now implemented generically for any
`HugrView::Node` type.
BREAKING CHANGE: `SiblingMut` has a new type parameter for the wrapped
hugr type.
@zrho zrho force-pushed the zrho/ext-set-core branch 2 times, most recently from 1231e57 to f16df5a Compare April 25, 2025 13:43
aborgna-q and others added 2 commits April 28, 2025 12:55
Re-created from #2113, targeting the release branch instead.

BREAKING CHANGE: Downstream crates need to remove the model_unstable
feature flag when referencing hugr or hugr-core.

---------

Co-authored-by: Lukas Heidemann <[email protected]>
Closes #2077

BREAKING CHANGE: Removed `RootTagged` trait. Now `RootChecked` is a
non-hugrview wrapper only used to verify inputs where appropriate.
@zrho zrho force-pushed the zrho/ext-set-core branch from f16df5a to 4d0d5c2 Compare April 29, 2025 10:17
This PR splits the `Rewrite` trait into two (three) traits:
- a `VerifyPatch` trait that has the `fn verify` and `fn
invalidation_set` functions
- a `ApplyPatch` trait that has the `fn apply` function. This inherits
`VerifyPatch` and is the "rewriting" trait that should be used in most
scenarios.

In addition, there is a third trait `ApplyPatchHugrMut` that can be
implemented by any patches that can be applied to _any_ `HugrMut` (as
opposed to a specific type `H`). This is strictly stronger than
`ApplyPatch` and should be implemented instead of `ApplyPatch` where
possible (see the docs of the traits).

closes #588
closes #2052

BREAKING CHANGE: Replaced the `Rewrite` trait with `Patch`.
`Rewrite::ApplyResult` is now `Patch::Outcome`. `Rewrite::verify` was
split into a separate trait, and is now `PatchVerification::verify`.
BREAKING CHANGE: Renamed `hugr.rewrite` module to `hugr.patch`.
BREAKING CHANGE: Changed the type `OutlineCfg::ApplyResult` (now
`OutlineCfg::Outcome`) from `(Node, Node)` to `[Node; 2]`.

---------

Co-authored-by: Alan Lawrence <[email protected]>
Co-authored-by: Alan Lawrence <[email protected]>
aborgna-q and others added 3 commits April 29, 2025 14:10
Bumps the minimum supported rust version to 1.85, ~and migrates to the
2024 edition~.

Most of the changes here are automated. The diff is quite noisy due to
some changes in formatting, and me using this opportunity to auto--fix
some optional clippy lints. It may be easier to check the changes
per-commit.

EDIT: Edition change has been left for a separate PR, as it's quite
noisy.

BREAKING CHANGE: Bumped MSRV to 1.85
Moves some methods around in `HugrInternals` / `HugrView` that we'll
require for #1926 and #2029. Notable changes:

- Adds a `hierarchy` method to `HugrInternals` that replaces most calls
to `base_hugr`.
- `HugrInternals::base_hugr` is now deprecated. It's only used by
`Sibling/DescendantGraph`, `validate` and a random use in
`DeadCodeElimPass`.
- Adds a `HugrInternals::region_portgraph` method that returns a
`FlatRegion` portgraph wrapper, and a `HugrView::descendants` call.
These lets us replace most uses of `SiblingGraph` and `DescendantGraph`.
- Renamed `HugrInternals::{get_pg_index,get_node}` to
`to_portgraph_node` and `from_portgraph_node`.

This requires some new changes in `portgraph`. I'll make a minor release
and update it here before merging.

We should be able to remove `base_hugr` after #2029. The deprecation
warning here is only temporary.

BREAKING CHANGE: Modified multiple core `HugrView` and `HugrInternals`
trait methods. See #2126.
Oupsie, during one of the merge conflict resolutions I must have
forgotten to remove the old `rewrite.rs` file. As you can see in the
`hugr-core/src/hugr.rs` file, this is no longer a module and thus the
file should be deleted. It has been renamed to `patch.rs` in #2070
@aborgna-q aborgna-q linked an issue Apr 30, 2025 that may be closed by this pull request
Copy link
Contributor

@croyzor croyzor left a comment

Choose a reason for hiding this comment

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

Nice! Some minor things:

  • I think this should target the breaking release branch instead of main
  • Could you update the spec as well to remove mention of the stuff that's been deleted?
  • In the schemas, FunctionType still has a field for runtime_reqs

@aborgna-q aborgna-q removed this from the hugr-rs 0̶.̶1̶6̶ 0.20 milestone Apr 30, 2025
@zrho zrho force-pushed the zrho/ext-set-core branch from bc8cd2c to 760bac7 Compare April 30, 2025 14:50
@hugrbot
Copy link
Collaborator

hugrbot commented Apr 30, 2025

⚠️ Breaking Change Alert ⚠️

This PR contains a breaking change and is targeting the main branch.

Breaking changes are currently not allowed to be merged into main and should instead target the release branch release-rs-v0.16.0.

Please update your PR to target the appropriate branch.

@zrho zrho force-pushed the zrho/ext-set-core branch from 5623944 to 7559007 Compare April 30, 2025 15:39
@zrho zrho force-pushed the zrho/ext-set-core branch from 7559007 to da4b16e Compare April 30, 2025 16:09
@zrho
Copy link
Contributor Author

zrho commented Apr 30, 2025

Closed in favour of #2145, retargeting to the release branch.

@zrho zrho closed this Apr 30, 2025
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.

Remove extension sets
9 participants