diff --git a/hugr-core/Cargo.toml b/hugr-core/Cargo.toml index 477f8f499..274c21837 100644 --- a/hugr-core/Cargo.toml +++ b/hugr-core/Cargo.toml @@ -20,7 +20,6 @@ workspace = true extension_inference = [] declarative = ["serde_yaml"] model_unstable = ["hugr-model"] -default = ["model_unstable"] [[test]] name = "model" diff --git a/hugr-core/src/export.rs b/hugr-core/src/export.rs index 966f3c680..55d586b7b 100644 --- a/hugr-core/src/export.rs +++ b/hugr-core/src/export.rs @@ -269,7 +269,6 @@ impl<'a> Context<'a> { let decl = this.bump.alloc(model::AliasDecl { name: &alias.name, params: &[], - constraints: &[], r#type, }); model::Operation::DeclareAlias { decl } @@ -282,7 +281,6 @@ impl<'a> Context<'a> { let decl = this.bump.alloc(model::AliasDecl { name: &alias.name, params: &[], - constraints: &[], r#type, }); model::Operation::DefineAlias { decl, value } diff --git a/hugr-model/capnp/hugr-v0.capnp b/hugr-model/capnp/hugr-v0.capnp index 19612bf53..94341beba 100644 --- a/hugr-model/capnp/hugr-v0.capnp +++ b/hugr-model/capnp/hugr-v0.capnp @@ -70,16 +70,14 @@ struct Operation { struct AliasDefn { name @0 :Text; params @1 :List(Param); - constraints @2 :List(TermId); - type @3 :TermId; - value @4 :TermId; + type @2 :TermId; + value @3 :TermId; } struct AliasDecl { name @0 :Text; params @1 :List(Param); - constraints @2 :List(TermId); - type @3 :TermId; + type @2 :TermId; } struct ConstructorDecl { diff --git a/hugr-model/src/v0/binary/read.rs b/hugr-model/src/v0/binary/read.rs index e352aba93..5381a7dc8 100644 --- a/hugr-model/src/v0/binary/read.rs +++ b/hugr-model/src/v0/binary/read.rs @@ -168,13 +168,11 @@ fn read_operation<'a>( let reader = reader?; let name = bump.alloc_str(reader.get_name()?.to_str()?); let params = read_list!(bump, reader, get_params, read_param); - let constraints = read_scalar_list!(bump, reader, get_constraints, model::TermId); let r#type = model::TermId(reader.get_type()); let value = model::TermId(reader.get_value()); let decl = bump.alloc(model::AliasDecl { name, params, - constraints, r#type, }); model::Operation::DefineAlias { decl, value } @@ -183,12 +181,10 @@ fn read_operation<'a>( let reader = reader?; let name = bump.alloc_str(reader.get_name()?.to_str()?); let params = read_list!(bump, reader, get_params, read_param); - let constraints = read_scalar_list!(bump, reader, get_constraints, model::TermId); let r#type = model::TermId(reader.get_type()); let decl = bump.alloc(model::AliasDecl { name, params, - constraints, r#type, }); model::Operation::DeclareAlias { decl } diff --git a/hugr-model/src/v0/binary/write.rs b/hugr-model/src/v0/binary/write.rs index e6ac64201..f3a0a14d2 100644 --- a/hugr-model/src/v0/binary/write.rs +++ b/hugr-model/src/v0/binary/write.rs @@ -75,7 +75,6 @@ fn write_operation(mut builder: hugr_capnp::operation::Builder, operation: &mode let mut builder = builder.init_alias_defn(); builder.set_name(decl.name); write_list!(builder, init_params, write_param, decl.params); - let _ = builder.set_constraints(model::TermId::unwrap_slice(decl.constraints)); builder.set_type(decl.r#type.0); builder.set_value(value.0); } @@ -83,7 +82,6 @@ fn write_operation(mut builder: hugr_capnp::operation::Builder, operation: &mode let mut builder = builder.init_alias_decl(); builder.set_name(decl.name); write_list!(builder, init_params, write_param, decl.params); - let _ = builder.set_constraints(model::TermId::unwrap_slice(decl.constraints)); builder.set_type(decl.r#type.0); } diff --git a/hugr-model/src/v0/mod.rs b/hugr-model/src/v0/mod.rs index 0a5b4c169..16c7cb6c6 100644 --- a/hugr-model/src/v0/mod.rs +++ b/hugr-model/src/v0/mod.rs @@ -410,8 +410,6 @@ pub struct AliasDecl<'a> { pub name: &'a str, /// The static parameters of the alias. pub params: &'a [Param<'a>], - /// The constraints on the static parameters. - pub constraints: &'a [TermId], /// The type of the alias. pub r#type: TermId, } diff --git a/hugr-model/src/v0/text/hugr.pest b/hugr-model/src/v0/text/hugr.pest index 4c3bd169e..d05e3d774 100644 --- a/hugr-model/src/v0/text/hugr.pest +++ b/hugr-model/src/v0/text/hugr.pest @@ -57,7 +57,7 @@ node_custom = { "(" ~ (term_apply | term_apply_full) ~ port_lists? ~ signature = { "(" ~ "signature" ~ term ~ ")" } func_header = { symbol ~ param* ~ where_clause* ~ term ~ term ~ term } -alias_header = { symbol ~ param* ~ where_clause* ~ term } +alias_header = { symbol ~ param* ~ term } ctr_header = { symbol ~ param* ~ where_clause* ~ term } operation_header = { symbol ~ param* ~ where_clause* ~ term } diff --git a/hugr-model/src/v0/text/parse.rs b/hugr-model/src/v0/text/parse.rs index 672edbbe9..370dbeac0 100644 --- a/hugr-model/src/v0/text/parse.rs +++ b/hugr-model/src/v0/text/parse.rs @@ -576,13 +576,11 @@ impl<'a> ParseContext<'a> { let mut inner = pair.into_inner(); let name = self.parse_symbol(&mut inner)?; let params = self.parse_params(&mut inner)?; - let constraints = self.parse_constraints(&mut inner)?; let r#type = self.parse_term(inner.next().unwrap())?; Ok(self.bump.alloc(AliasDecl { name, params, - constraints, r#type, })) } diff --git a/hugr-model/src/v0/text/print.rs b/hugr-model/src/v0/text/print.rs index 561d55e70..512f6d1e4 100644 --- a/hugr-model/src/v0/text/print.rs +++ b/hugr-model/src/v0/text/print.rs @@ -294,7 +294,6 @@ impl<'p, 'a: 'p> PrintContext<'p, 'a> { }); this.print_params(decl.params)?; - this.print_constraints(decl.constraints)?; this.print_term(decl.r#type)?; this.print_term(*value)?; @@ -308,7 +307,6 @@ impl<'p, 'a: 'p> PrintContext<'p, 'a> { }); this.print_params(decl.params)?; - this.print_constraints(decl.constraints)?; this.print_term(decl.r#type)?; this.print_meta(node_data.meta)?;