3 ms·
I see what you mean, but I think there are two orthogonal issues here. One is the ownership/lifetime of the heap allocation. That is indeed coupled to a stack o
by dthul 7y ago
I see what you mean, but I think there are two orthogonal issues here.
One is the ownership/lifetime of the heap allocation. That is indeed coupled to a stack object, because non-stack bound lifetimes can (with the current state-of-the-art) not be analyzed at compile time. Calling this shoehorning is strange, that's the whole idea of RAII.
The other issue is borrows of heap objects, which the borrow checker can of course handle since they are no different than borrows to stack objects.