diff --git a/crates/ir/src/lib.rs b/crates/ir/src/lib.rs index 82fe917..ecf132b 100644 --- a/crates/ir/src/lib.rs +++ b/crates/ir/src/lib.rs @@ -46,7 +46,8 @@ use serde::{Deserialize, Serialize}; // TODO: write more top-level docs // TODO: reintroduce validation logic -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -60,7 +61,8 @@ pub struct Program { pub symbols: Vec, } -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -86,7 +88,8 @@ pub struct Relation { pub rules: Vec>, } -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -101,7 +104,8 @@ pub struct Rule { pub body: RuleBody, } -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -116,7 +120,8 @@ pub struct Assumption { pub body: RuleBody, } -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -143,7 +148,8 @@ pub struct RuleBody { /// backend. With a top-down approach, the expression nodes are used to constrain some /// query, but with a bottom-up approach, the expression nodes are used directly to /// produce new sets of results from their children. -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -156,7 +162,8 @@ pub struct Expr { } /// An expression node variant. See [Expr]. -#[derive_where(Clone, Debug, PartialEq, Eq)] +#[derive_where(Clone, PartialEq, Eq)] +#[derive_where(Debug; T: DebugProgramInfo)] #[derive_where(PartialOrd, Ord; T: OrdProgramInfo)] #[derive_where(Hash; T: HashProgramInfo)] #[cfg_attr(feature = "serde", derive_where(Deserialize, Serialize; T: SerdeProgramInfo))] @@ -436,9 +443,9 @@ pub trait ProgramInfo { } /// A blanket trait bounding all associated types in [ProgramInfo]. -pub trait Info: Clone + Debug + Eq {} +pub trait Info: Clone + Eq {} -impl Info for T {} +impl Info for T {} /// Creates a new trait to further bound the members of [ProgramInfo]. macro_rules! def_bound_info { @@ -476,6 +483,7 @@ macro_rules! def_bound_info { }; } +def_bound_info!(DebugProgramInfo, Debug); def_bound_info!(OrdProgramInfo, Ord); def_bound_info!(HashProgramInfo, Hash);