-
Notifications
You must be signed in to change notification settings - Fork 37
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
refactor(hydroflow_plus): split up location module and store locations directly in streams #1523
Conversation
dc1bd72
to
287635f
Compare
@@ -134,24 +137,24 @@ impl<'a, T, N: Location<'a>> DeferTick for Singleton<T, Bounded, Tick<N>> { | |||
|
|||
impl<'a, T, N: Location<'a>> CycleComplete<'a, TickCycle> for Singleton<T, Bounded, Tick<N>> { | |||
fn complete(self, ident: syn::Ident) { | |||
self.flow_state.borrow_mut().leaves.as_mut().expect("Attempted to add a leaf to a flow that has already been finalized. No leaves can be added after the flow has been compiled.").push(HfPlusLeaf::CycleSink { | |||
self.flow_state().clone().borrow_mut().leaves.as_mut().expect("Attempted to add a leaf to a flow that has already been finalized. No leaves can be added after the flow has been compiled.").push(HfPlusLeaf::CycleSink { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the clone? Rc will just increment then immediately decrement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Borrow checker is unhappy if we don't clone because self
is borrowed by .flow_state()
but we need to move the IR node.
self.flow_state().clone().borrow_mut().leaves.as_mut().expect("Attempted to add a leaf to a flow that has already been finalized. No leaves can be added after the flow has been compiled.").push(HfPlusLeaf::CycleSink { | ||
ident, | ||
location_kind: self.location_kind, | ||
location_kind: self.location_kind(), | ||
input: Box::new(self.ir_node.into_inner()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could avoid the clone via
input: Box::new(self.ir_node.replace(HfPlusNode::Placeholder)),
(or implement Default
for HfPlusNode
-> Placeholder
and use self.ir_node.take()
)
Doesn't really matter that much though
…s directly in streams
No description provided.