Phobos is now compiled with -preview=dip1000
anonymous at example.com
Fri May 17 18:22:21 UTC 2019
On 17.05.19 19:25, Meta wrote:
> I don't want to *restrict* the lifetime of a heap allocation. I want the
> compiler to recognize that the lifetime of my original data is the same
> as the processed output, and thus allow my code to compile.
You have a heap allocation that references your original data, which
might be on the stack (Queue.store points into rawData). The compiler
would have to make sure (or recognize) that the pointers on the heap
don't outlive the data to which they point.
But the lifetime of the heap allocation is infinite, and the lifetime of
the stack data is not. So that fails. To make it work you'd need some
way to have a shorter-than-infinite lifetime for the heap.
Whether you want to restrict the lifetime explicitly or have the
compiler figure it out on its own ... it doesn't really matter when we
can't do either.
More information about the Digitalmars-d-announce