Skip to content
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

chore: remove rustversion #764

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ petgraph = { version = "0.6.3", default-features = false }
context-iterators = "0.2.0"
serde_json = "1.0.97"
delegate = "0.12.0"
rustversion = "1.0.14"
paste = "1.0"
strum = "0.25.0"
strum_macros = "0.25.3"
Expand All @@ -68,4 +67,3 @@ harness = false

[profile.dev.package]
insta.opt-level = 3
similar.opt-level = 3
36 changes: 18 additions & 18 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": 1700140236,
"narHash": "sha256-OpukFO0rRG2hJzD+pCQq+nSWuT9dBL6DSvADQaUlmFg=",
"lastModified": 1703939110,
"narHash": "sha256-GgjYWkkHQ8pUBwXX++ah+4d07DqOeCDaaQL6Ab86C50=",
"owner": "cachix",
"repo": "devenv",
"rev": "525d60c44de848a6b2dd468f6efddff078eb2af2",
"rev": "7354096fc026f79645fdac73e9aeea71a09412c3",
"type": "github"
},
"original": {
Expand All @@ -25,11 +25,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1700461394,
"narHash": "sha256-lBpjEshdBxeuJwc4+vh4jbO3AmhXbiFrkdWy2pABAAc=",
"lastModified": 1704262971,
"narHash": "sha256-3HB1yaMBBox3z9oXEiQuZzQhXegOc9P3FR6/XNsJGn0=",
"owner": "nix-community",
"repo": "fenix",
"rev": "5ad1b10123ca40c9d983fb0863403fd97a06c0f8",
"rev": "38aaea4e54dc3874a6355c10861bd8316a6f09f3",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -95,11 +95,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1700444282,
"narHash": "sha256-s/+tgT+Iz0LZO+nBvSms+xsMqvHt2LqYniG9r+CYyJc=",
"lastModified": 1704008649,
"narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3f21a22b5aafefa1845dec6f4a378a8f53d8681c",
"rev": "d44d59d2b5bd694cd9d996fd8c51d03e3e9ba7f7",
"type": "github"
},
"original": {
Expand All @@ -111,11 +111,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1700403855,
"narHash": "sha256-Q0Uzjik9kUTN9pd/kp52XJi5kletBhy29ctBlAG+III=",
"lastModified": 1704018918,
"narHash": "sha256-erjg/HrpC9liEfm7oLqb8GXCqsxaFwIIPqCsknW5aFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0c5678df521e1407884205fe3ce3cf1d7df297db",
"rev": "2c9c58e98243930f8cb70387934daa4bc8b00373",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -152,11 +152,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1700064067,
"narHash": "sha256-1ZWNDzhu8UlVCK7+DUN9dVQfiHX1bv6OQP9VxstY/gs=",
"lastModified": 1703939133,
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e558068cba67b23b4fbc5537173dbb43748a17e8",
"rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38",
"type": "github"
},
"original": {
Expand All @@ -177,11 +177,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1700247620,
"narHash": "sha256-+Xg0qZLbC9dZx0Z6JbaVHR/BklAr2I83dzKLB8r41c8=",
"lastModified": 1704207973,
"narHash": "sha256-VEWsjIKtdinx5iyhfxuTHRijYBKSbO/8Gw1HPoWD9mQ=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "255eed40c45fcf108ba844b4ad126bdc4e7a18df",
"rev": "426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746",
"type": "github"
},
"original": {
Expand Down
2 changes: 1 addition & 1 deletion devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ in
# https://devenv.sh/languages/
# https://devenv.sh/reference/options/#languagesrustversion
languages.rust = {
channel = "beta";
channel = "stable";
enable = true;
components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
};
Expand Down
14 changes: 3 additions & 11 deletions src/hugr/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ use portgraph::{multiportgraph, LinkView, MultiPortGraph, PortView};
use super::{Hugr, HugrError, NodeMetadata, NodeMetadataMap, NodeType, DEFAULT_NODETYPE};
use crate::ops::handle::NodeHandle;
use crate::ops::{FuncDecl, FuncDefn, OpName, OpTag, OpTrait, OpType, DFG};
#[rustversion::since(1.75)] // uses impl in return position

use crate::types::Type;
use crate::types::{EdgeKind, FunctionType, PolyFuncType};
use crate::{Direction, IncomingPort, Node, OutgoingPort, Port};
#[rustversion::since(1.75)] // uses impl in return position

use itertools::Either;

/// A trait for inspecting HUGRs.
Expand Down Expand Up @@ -183,7 +183,6 @@ pub trait HugrView: sealed::HugrInternals {
/// Iterator over the nodes and ports connected to a port.
fn linked_ports(&self, node: Node, port: impl Into<Port>) -> Self::PortLinks<'_>;

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all the nodes and ports connected to a node in a given direction.
fn all_linked_ports(
&self,
Expand All @@ -205,15 +204,13 @@ pub trait HugrView: sealed::HugrInternals {
}
}

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all the nodes and ports connected to a node's inputs.
fn all_linked_outputs(&self, node: Node) -> impl Iterator<Item = (Node, OutgoingPort)> {
self.all_linked_ports(node, Direction::Incoming)
.left()
.unwrap()
}

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all the nodes and ports connected to a node's outputs.
fn all_linked_inputs(&self, node: Node) -> impl Iterator<Item = (Node, IncomingPort)> {
self.all_linked_ports(node, Direction::Outgoing)
Expand Down Expand Up @@ -411,7 +408,6 @@ pub trait HugrView: sealed::HugrInternals {
.map(|(n, _)| n)
}

#[rustversion::since(1.75)] // uses impl in return position
/// If a node has a static output, return the targets.
fn static_targets(&self, node: Node) -> Option<impl Iterator<Item = (Node, IncomingPort)>> {
Some(self.linked_inputs(node, self.get_optype(node).static_output_port()?))
Expand All @@ -423,7 +419,6 @@ pub trait HugrView: sealed::HugrInternals {
self.get_optype(node).dataflow_signature()
}

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all outgoing ports that have Value type, along
/// with corresponding types.
fn value_types(&self, node: Node, dir: Direction) -> impl Iterator<Item = (Port, Type)> {
Expand All @@ -432,15 +427,13 @@ pub trait HugrView: sealed::HugrInternals {
.flat_map(move |port| sig.port_type(port).map(|typ| (port, typ.clone())))
}

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all incoming ports that have Value type, along
/// with corresponding types.
fn in_value_types(&self, node: Node) -> impl Iterator<Item = (IncomingPort, Type)> {
self.value_types(node, Direction::Incoming)
.map(|(p, t)| (p.as_incoming().unwrap(), t))
}

#[rustversion::since(1.75)] // uses impl in return position
/// Iterator over all incoming ports that have Value type, along
/// with corresponding types.
fn out_value_types(&self, node: Node) -> impl Iterator<Item = (OutgoingPort, Type)> {
Expand Down Expand Up @@ -618,7 +611,6 @@ impl<T: AsRef<Hugr>> HugrView for T {
}
}

#[rustversion::since(1.75)] // uses impl in return position
/// Trait implementing methods on port iterators.
pub trait PortIterator<P>: Iterator<Item = (Node, P)>
where
Expand All @@ -636,7 +628,7 @@ where
})
}
}
#[rustversion::since(1.75)] // uses impl in return position

impl<I, P> PortIterator<P> for I
where
I: Iterator<Item = (Node, P)>,
Expand Down
4 changes: 0 additions & 4 deletions src/hugr/views/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ fn dot_string(sample_hugr: (Hugr, BuildHandle<DataflowOpID>, BuildHandle<Dataflo
insta::assert_yaml_snapshot!(h.dot_string());
}

#[rustversion::since(1.75)] // uses impl in return position
#[rstest]
fn all_ports(sample_hugr: (Hugr, BuildHandle<DataflowOpID>, BuildHandle<DataflowOpID>)) {
use itertools::Itertools;
Expand Down Expand Up @@ -97,7 +96,6 @@ fn all_ports(sample_hugr: (Hugr, BuildHandle<DataflowOpID>, BuildHandle<Dataflow
);
}

#[rustversion::since(1.75)] // uses impl in return position
#[test]
fn value_types() {
use crate::builder::Container;
Expand Down Expand Up @@ -129,7 +127,6 @@ fn value_types() {
assert_eq!(&out_types[..], &[(0.into(), BOOL_T), (1.into(), QB_T)]);
}

#[rustversion::since(1.75)] // uses impl in return position
#[test]
fn static_targets() {
use crate::extension::{
Expand Down Expand Up @@ -157,7 +154,6 @@ fn static_targets() {
)
}

#[rustversion::since(1.75)] // uses impl in return position
#[test]
fn test_dataflow_ports_only() {
use crate::builder::DataflowSubContainer;
Expand Down