-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
I have some code where we'd like to use Lazy values as fields of structs, which means boxing closures:
type AnyLazy<'a, T> = Lazy<T, Box<dyn FnOnce() -> T + 'a>>;The problem is that this type alias is invariant in 'a, because Lazy<T, F> is invariant in F. So actually using this type causes insurmountable lifetime issues in our code.
I hesitate to ask for this, because the only way to get it is to lie a lot to Rust about what's inside the Cell. The API would be safe, but I don't see a way to do it without a fairly gross amount of unsafe code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels