-
-
Notifications
You must be signed in to change notification settings - Fork 77
Allow FnMut in blocks? #571
Copy link
Copy link
Closed as not planned
Labels
A-block2Affects the `block2` crateAffects the `block2` crateenhancementNew feature or requestNew feature or request
Description
Activity
Metadata
Metadata
Assignees
Labels
A-block2Affects the `block2` crateAffects the `block2` crateenhancementNew feature or requestNew feature or request
Upstream issue: SSheldon/rust-block#12.
Should we allow
Block<dyn FnMut()>, and how would we do it safely?At the very least, we'd have to prevent any form of
Block::copy/RcBlock::cloneon these, as that could lead to multiple mutable references being present. In particular, it is difficult to prevent re-entrancy if the block is shared.This decision is blocked on a resolution in #563, though we might still decide to allow
FnMutinblock2, even if we don't allow it inobjc2, as most (non-@escaping, non-@Sendable, see #572) blocks (probably) really are safely mutable.See also #168 (comment) for discussion on why
FnOnceis impossible, we should document that somewhere more visible when tackling this issue. Or maybe addRcBlock::once, similar towasm-bindgen?