From 8fb6de392bbac104c07a5cdbac12a4fd25ab1127 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 04:56:37 +0900 Subject: fix(semver): resolve shirabe-semver compile errors - Replace RefCell with Mutex in Constraint for thread safety - Add clone_box() to ConstraintInterface for cloning trait objects - Propagate Result from Constraint::new() and unwrap at call sites - Fix VersionParser instantiation (unit struct, not fn) - Add indexmap dependency to shirabe-semver --- crates/shirabe-semver/src/constraint/multi_constraint.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'crates/shirabe-semver/src/constraint/multi_constraint.rs') diff --git a/crates/shirabe-semver/src/constraint/multi_constraint.rs b/crates/shirabe-semver/src/constraint/multi_constraint.rs index 86afa8d..29d6f5e 100644 --- a/crates/shirabe-semver/src/constraint/multi_constraint.rs +++ b/crates/shirabe-semver/src/constraint/multi_constraint.rs @@ -166,8 +166,8 @@ impl MultiConstraint { Some(Box::new( MultiConstraint::new( vec![ - l_mc.constraints[0].clone(), - r_mc.constraints[1].clone(), + l_mc.constraints[0].clone_box(), + r_mc.constraints[1].clone_box(), ], true, ) @@ -311,6 +311,17 @@ impl ConstraintInterface for MultiConstraint { !self.conjunctive } + fn clone_box(&self) -> Box { + Box::new(MultiConstraint { + constraints: self.constraints.iter().map(|c| c.clone_box()).collect(), + pretty_string: self.pretty_string.clone(), + string: RefCell::new(self.string.borrow().clone()), + conjunctive: self.conjunctive, + lower_bound: RefCell::new(self.lower_bound.borrow().clone()), + upper_bound: RefCell::new(self.upper_bound.borrow().clone()), + }) + } + fn as_any(&self) -> &dyn std::any::Any { self } -- cgit v1.3.1