You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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::clone on 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 FnMut in block2, even if we don't allow it in objc2, as most (non-@escaping, non-@Sendable, see #572) blocks (probably) really are safely mutable.
See also #168 (comment) for discussion on why FnOnce is impossible, we should document that somewhere more visible when tackling this issue. Or maybe add RcBlock::once, similar to wasm-bindgen?
The text was updated successfully, but these errors were encountered:
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::clone
on 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
FnMut
inblock2
, 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
FnOnce
is impossible, we should document that somewhere more visible when tackling this issue. Or maybe addRcBlock::once
, similar towasm-bindgen
?The text was updated successfully, but these errors were encountered: