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
{{ message }}
Repository navigation
Array destructuring rest element aliases the source array (writes leak into it; rc crash on push) #477
In const [first, ...rest] = src, rest shares src's data block instead of being a new array. Writing to rest changes src, and under rc a push onto rest crashes, because it reallocates a pointer into the middle of src's block.
src[1] after rest[0]=20: 20. src was changed through rest
none
the same as gc
rc
exits with 127 and prints nothing
Cause: MLIRGenVariables.cpp (around lines 350 and 382) builds the rest element with ts.ArrayView, which is src's data pointer plus an offset, with a length. It is not a copy. TypeScript makes the rest element a new array.
Found while investigating #453. The array-as-reference design for #453 needs the rest element to be a copy anyway.
Activity
Lowering: one helper knows the array layout (#453 step 1) (#478)
Arrays grow by doubling (#453 step 3) (#482)