A moved Vec's old buffer is to be poisoned in a dev build, and the unread generation word goes

This commit is contained in:
Joseph Ferano 2026-09-25 10:06:41 +07:00
parent aa1bbe550c
commit cf737076e9

View File

@ -1242,7 +1242,8 @@ build, because a layout that changes with a build flag can disagree silently
across the reload boundary. One addition: a budget, because =retry= needs a
handler that can make the same request succeed.
** TODO The Vec generation word has no reader
** NEXT The Vec generation word has no reader
Decided 2026-09-25: remove the word, and in a dev build fill a Vec's old buffer with the dead-beef pattern when a push moves it, so a stale slice reads visibly wrong values. No slice layout change; a release build is untouched. Rules out a dev-only word on every slice.
It is bumped on reallocation and read by nothing. The stale-slice trap it exists
for needs a slice that can carry the Vec's identity, and a slice is pointer and
length — so either slices grow a word in a dev build or the trap does not exist.