diff --git a/lib/src/default_revset_engine.rs b/lib/src/default_revset_engine.rs index 162a22416..8c291231d 100644 --- a/lib/src/default_revset_engine.rs +++ b/lib/src/default_revset_engine.rs @@ -48,6 +48,10 @@ impl ToPredicateFn for Box { trait InternalRevset<'index>: fmt::Debug + ToPredicateFn { // All revsets currently iterate in order of descending index position fn iter(&self) -> Box> + '_>; + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a; } pub struct RevsetImpl<'index> { @@ -215,6 +219,13 @@ impl<'index> InternalRevset<'index> for EagerRevset<'index> { fn iter(&self) -> Box> + '_> { Box::new(self.index_entries.iter().cloned()) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for EagerRevset<'_> { @@ -240,6 +251,13 @@ where fn iter(&self) -> Box> + '_> { Box::new(self.walk.clone()) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl<'index, T> ToPredicateFn for RevWalkRevset @@ -286,6 +304,13 @@ impl<'index> InternalRevset<'index> for ChildrenRevset<'index> { .any(|parent_pos| roots.contains(parent_pos)) })) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for ChildrenRevset<'_> { @@ -306,6 +331,13 @@ impl<'index, P: ToPredicateFn> InternalRevset<'index> for FilterRevset<'index, P let p = self.predicate.to_predicate_fn(); Box::new(self.candidates.iter().filter(p)) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for FilterRevset<'_, P> { @@ -330,6 +362,13 @@ impl<'index> InternalRevset<'index> for UnionRevset<'index> { iter2: self.set2.iter().peekable(), }) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for UnionRevset<'_> { @@ -383,6 +422,13 @@ impl<'index> InternalRevset<'index> for IntersectionRevset<'index> { iter2: self.set2.iter().peekable(), }) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for IntersectionRevset<'_> { @@ -448,6 +494,13 @@ impl<'index> InternalRevset<'index> for DifferenceRevset<'index> { iter2: self.set2.iter().peekable(), }) } + + fn into_predicate<'a>(self: Box) -> Box + where + Self: 'a, + { + self + } } impl ToPredicateFn for DifferenceRevset<'_> {