-
Notifications
You must be signed in to change notification settings - Fork 70
Getting &T to work in blocks #837
Copy link
Copy link
Open
Labels
A-block2Affects the `block2` crateAffects the `block2` crateA-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for thembugSomething isn't workingSomething isn't working
Milestone
Metadata
Metadata
Assignees
Labels
A-block2Affects the `block2` crateAffects the `block2` crateA-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for thembugSomething isn't workingSomething isn't working
Ideally, we'd be able to write:
And call that with:
Currently, we map such blocks with
NonNull<NSString>instead, and users must dounsafe { string.as_ref() }before accessing it.You'd think that the
impl<T> IntoBlock<dyn Fn(T)> for Fn(T) { ... }that we currently have would be enough, but unfortunately, the lifetime infn(&T)is higher-ranked,Fn(&T)desugars tofor<'a> Fn(&'a T). Ideally, we'd instead write something likeimpl IntoBlock<dyn for<T> Fn(T)> for for<T> Fn(T), i.e. makeThigher-ranked, but that's an incomplete feature in the compiler, so likely a long ways away from being possible.Also discussed in #168, the solution that
cidregoes with is unsound IIRC.