Skip to content

feat: Add PersistentHugr #2080

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 2 commits into
base: feat/rewrite-trait
Choose a base branch
from
Open

Conversation

lmondada
Copy link
Contributor

@lmondada lmondada commented Apr 15, 2025

The base of this PR will be moved to main once #2070 has been merged in.

Status: The API and main structs have been defined. Most of the core logic has yet to be implemented.

Status: PR is ready. The trait implementations for HugrView, VerifyPatch and ApplyPatch will be in a separate PR once progress on those is unblocked.

Closes #2096

@lmondada lmondada changed the base branch from main to feat/rewrite-trait April 15, 2025 10:48
@lmondada lmondada force-pushed the feat/persistenthugr branch from 44c3fe9 to 5780cda Compare April 15, 2025 10:49
@lmondada lmondada requested a review from aborgna-q April 15, 2025 10:52
@hugrbot
Copy link
Collaborator

hugrbot commented Apr 15, 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 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.40.0/src/lints/enum_missing.ron

Failed in:
enum hugr_core::hugr::rewrite::consts::RemoveError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/consts.rs:18
enum hugr_core::hugr::rewrite::outline_cfg::OutlineCfgError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/outline_cfg.rs:221
enum hugr_core::hugr::rewrite::replace::WhichHugr, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:433
enum hugr_core::hugr::rewrite::BoundaryPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:14
enum hugr_core::hugr::rewrite::inline_call::InlineCallError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_call.rs:17
enum hugr_core::hugr::rewrite::replace::NewEdgeKind, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:31
enum hugr_core::hugr::rewrite::replace::ReplaceError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:397
enum hugr_core::hugr::rewrite::simple_replace::SimpleReplacementError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:351
enum hugr_core::hugr::rewrite::SimpleReplacementError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:351
enum hugr_core::hugr::rewrite::insert_identity::IdentityInsertionError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/insert_identity.rs:38
enum hugr_core::hugr::rewrite::inline_dfg::InlineDFGError, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_dfg.rs:15

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

Failed in:
ExtensionOp::cast, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/custom.rs:131
ExtensionOp::extension_id, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/custom.rs:136
ExtensionOp::cast, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/custom.rs:131
ExtensionOp::extension_id, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/ops/custom.rs:136

--- 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.40.0/src/lints/module_missing.ron

Failed in:
mod hugr_core::hugr::rewrite::insert_identity, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/insert_identity.rs:1
mod hugr_core::hugr::rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite.rs:1
mod hugr_core::hugr::rewrite::replace, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:1
mod hugr_core::hugr::rewrite::inline_dfg, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_dfg.rs:1
mod hugr_core::hugr::rewrite::outline_cfg, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/outline_cfg.rs:1
mod hugr_core::hugr::rewrite::consts, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/consts.rs:1
mod hugr_core::hugr::rewrite::inline_call, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_call.rs:1
mod hugr_core::hugr::rewrite::simple_replace, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.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.40.0/src/lints/struct_missing.ron

Failed in:
struct hugr_core::hugr::rewrite::outline_cfg::OutlineCfg, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/outline_cfg.rs:23
struct hugr_core::hugr::rewrite::replace::NewEdgeSpec, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:18
struct hugr_core::hugr::rewrite::inline_call::InlineCall, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_call.rs:12
struct hugr_core::hugr::rewrite::replace::Replacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/replace.rs:57
struct hugr_core::hugr::rewrite::inline_dfg::InlineDFG, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/inline_dfg.rs:10
struct hugr_core::hugr::rewrite::insert_identity::IdentityInsertion, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/insert_identity.rs:18
struct hugr_core::hugr::rewrite::consts::RemoveConst, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/consts.rs:73
struct hugr_core::hugr::rewrite::simple_replace::SimpleReplacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:26
struct hugr_core::hugr::rewrite::SimpleReplacement, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/simple_replace.rs:26
struct hugr_core::hugr::rewrite::Transactional, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite.rs:53
struct hugr_core::hugr::rewrite::consts::RemoveLoadConstant, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/consts.rs:13
struct hugr_core::hugr::rewrite::HostPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:23
struct hugr_core::hugr::rewrite::ReplacementPort, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite/port_types.rs:27

--- 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.40.0/src/lints/trait_missing.ron

Failed in:
trait hugr_core::hugr::rewrite::Rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite.rs:19
trait hugr_core::hugr::Rewrite, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/rewrite.rs:19
trait hugr_core::hugr::rewrite::simple_replace::HugrMutInternals, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/internal.rs:209

--- failure trait_removed_supertrait: supertrait removed or renamed ---

Description:
A supertrait was removed from a trait. Users of the trait can no longer assume it can also be used like its supertrait.
      ref: https://doc.rust-lang.org/reference/items/traits.html#supertraits
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/trait_removed_supertrait.ron

Failed in:
supertrait hugr_core::hugr::rewrite::simple_replace::HugrMutInternals of trait HugrMut in file /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/hugr/hugrmut.rs:22

@lmondada lmondada force-pushed the feat/persistenthugr branch from 5780cda to 6659c40 Compare April 17, 2025 13:14
@lmondada lmondada marked this pull request as ready for review April 17, 2025 13:17
@lmondada lmondada requested a review from a team as a code owner April 17, 2025 13:17
@lmondada lmondada force-pushed the feat/persistenthugr branch from 6659c40 to c480927 Compare April 17, 2025 13:23
@lmondada
Copy link
Contributor Author

bus factor considerations: we might want to fold RelRc into Hugr at some point (at least the parts that we care about), but I'd suggest first figuring out what works/if it works before putting efforts into that.

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.

2 participants