Skip to content

Commit

Permalink
Merge branch 'main' into fix/no-resource-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Aug 29, 2023
2 parents a540422 + ae81e42 commit 2637201
Show file tree
Hide file tree
Showing 34 changed files with 2,106 additions and 712 deletions.
24 changes: 12 additions & 12 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1690534632,
"narHash": "sha256-kOXS9x5y17VKliC7wZxyszAYrWdRl1JzggbQl0gyo94=",
"lastModified": 1692700763,
"narHash": "sha256-pWbQEVSjlDfrrBoHv5XFe+IdYVpJXY8C9Wz7rO98yqU=",
"owner": "cachix",
"repo": "devenv",
"rev": "6568e7e485a46bbf32051e4d6347fa1fed8b2f25",
"rev": "6b84a85dd5cde41cbf992b6b2445bf25fe0abb21",
"type": "github"
},
"original": {
Expand All @@ -25,11 +25,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1690525255,
"narHash": "sha256-jWmEJsV0mbWhUTCmkVg0URTVaQxzX9SPx33DPJPOmWc=",
"lastModified": 1692944460,
"narHash": "sha256-9SWRcFh/TvpZ7hc84SvlwP5QPkahWMRB2mMZmkBhkBQ=",
"owner": "nix-community",
"repo": "fenix",
"rev": "6d22d0989ebc9e8fc7e1d15f973613fae928ebb2",
"rev": "dd160229ca7895895462291cded1ea313c1e306f",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -136,11 +136,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1690464206,
"narHash": "sha256-38V4kmOh6ikpfGiAS+Kt2H/TA2DubSqE66veP/jmB4Q=",
"lastModified": 1692274144,
"narHash": "sha256-BxTQuRUANQ81u8DJznQyPmRsg63t4Yc+0kcyq6OLz8s=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "9289996dcac62fd45836db7c07b87d2521eb526d",
"rev": "7e3517c03d46159fdbf8c0e5c97f82d5d4b0c8fa",
"type": "github"
},
"original": {
Expand All @@ -160,11 +160,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1690216158,
"narHash": "sha256-TUF0YoWweQj0hNHWykC1vtBQVUncARlLLPmQP9hUeME=",
"lastModified": 1692775770,
"narHash": "sha256-LwoR5N1JHykSte2Ak+Pj/HjJ9fKy9zMJNEftfBJQkLs=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "b64e5b3919b24bc784f36248e6e1f921ee7bb71b",
"rev": "f5b7c60ff7a79bfb3e10f3e98c81b7bb4cb53c68",
"type": "github"
},
"original": {
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/nest_cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn all_edges<'a, T: Copy + Clone + PartialEq + Eq + Hash + 'a>(
vec![]
};
cfg.successors(n)
.chain(extra.into_iter())
.chain(extra)
.map(EdgeDest::Forward)
.chain(cfg.predecessors(n).map(EdgeDest::Backward))
.unique()
Expand Down Expand Up @@ -389,7 +389,7 @@ impl<T: Copy + Clone + PartialEq + Eq + Hash> EdgeClassifier<T> {
let highest_target = be_up
.into_iter()
.map(|(dfs, _)| dfs)
.chain(min_dfs_target[0].into_iter());
.chain(min_dfs_target[0]);
(highest_target.min().unwrap_or(usize::MAX), bs)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/builder/build_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use super::{

use crate::Hugr;

use crate::hugr::HugrInternalsMut;
use crate::hugr::HugrMut;

/// Trait for HUGR container builders.
/// Containers are nodes that are parents of sibling graphs.
Expand Down Expand Up @@ -378,7 +378,7 @@ pub trait Dataflow: Container {
just_inputs.into_iter().unzip();
let (rest_types, rest_input_wires): (Vec<Type>, Vec<Wire>) =
inputs_outputs.into_iter().unzip();
input_wires.extend(rest_input_wires.into_iter());
input_wires.extend(rest_input_wires);

let tail_loop = ops::TailLoop {
just_inputs: input_types.into(),
Expand Down
4 changes: 2 additions & 2 deletions src/builder/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{ops::handle::NodeHandle, types::Type};

use crate::Node;
use crate::{
hugr::{HugrInternalsMut, NodeType},
hugr::{HugrMut, NodeType},
type_row, Hugr,
};

Expand Down Expand Up @@ -228,7 +228,7 @@ impl<B: AsMut<Hugr> + AsRef<Hugr>> BlockBuilder<B> {
branch_wire: Wire,
outputs: impl IntoIterator<Item = Wire>,
) -> Result<(), BuildError> {
Dataflow::set_outputs(self, [branch_wire].into_iter().chain(outputs.into_iter()))
Dataflow::set_outputs(self, [branch_wire].into_iter().chain(outputs))
}
fn create(
base: B,
Expand Down
2 changes: 1 addition & 1 deletion src/builder/conditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::{

use crate::Node;
use crate::{
hugr::{HugrInternalsMut, NodeType},
hugr::{HugrMut, NodeType},
Hugr,
};

Expand Down
7 changes: 4 additions & 3 deletions src/builder/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::types::{FunctionType, Signature};

use crate::extension::ExtensionSet;
use crate::Node;
use crate::{hugr::HugrInternalsMut, Hugr};
use crate::{hugr::HugrMut, Hugr};

/// Builder for a [`ops::DFG`] node.
#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -96,8 +96,9 @@ impl DFGBuilder<Hugr> {
}

impl HugrBuilder for DFGBuilder<Hugr> {
fn finish_hugr(self) -> Result<Hugr, ValidationError> {
self.base.validate()?;
fn finish_hugr(mut self) -> Result<Hugr, ValidationError> {
let closure = self.base.infer_extensions()?;
self.base.validate_with_extension_closure(closure)?;
Ok(self.base)
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/builder/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use super::{
BuildError, Container,
};

use crate::hugr::hugrmut::sealed::HugrMutInternals;
use crate::{
hugr::{views::HugrView, ValidationError},
ops,
Expand All @@ -18,10 +19,7 @@ use crate::types::Signature;
use crate::Node;
use smol_str::SmolStr;

use crate::{
hugr::{HugrInternalsMut, NodeType},
Hugr,
};
use crate::{hugr::NodeType, Hugr};

/// Builder for a HUGR module.
#[derive(Debug, Clone, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion src/builder/tail_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<B: AsMut<Hugr> + AsRef<Hugr>> TailLoopBuilder<B> {
out_variant: Wire,
rest: impl IntoIterator<Item = Wire>,
) -> Result<(), BuildError> {
Dataflow::set_outputs(self, [out_variant].into_iter().chain(rest.into_iter()))
Dataflow::set_outputs(self, [out_variant].into_iter().chain(rest))
}

/// Get a reference to the [`ops::TailLoop`]
Expand Down
3 changes: 3 additions & 0 deletions src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use crate::types::type_param::{check_type_arg, TypeArgError};
use crate::types::type_param::{TypeArg, TypeParam};
use crate::types::CustomType;

mod infer;
pub use infer::{infer_extensions, ExtensionSolution, InferExtensionError};

mod op_def;
pub use op_def::{CustomSignatureFunc, OpDef};
mod type_def;
Expand Down
Loading

0 comments on commit 2637201

Please sign in to comment.