Repository navigation
fix: seven small issues (#322, #323, #321, #324, #341, #356, #261) - #375
Merged
Merged
Conversation
`mkm(1)["a"]` read one value out of a map nothing else names and never
dropped the map (#322), and `m[key(1)]` never released an owned `str`
key (#323). c_map_index now holds an owned map and an owned key across
the lookup, which aborts on a missing key. The value is taken out
(c_taken) before the map is dropped. c_map_owned answers which maps are
this expression's own, and it recurses, so a map read out of an owned map
is owned too. c_index asks it before treating a map-read list as a borrow.
c_formap copied the map it walks and gave back the copy, so the map that
`for k in mkm(1)` was handed had no owner. An owned map (c_map_owned) is
now taken as the loop's own; one somebody else holds is still copied.
(#321)
The str→number conversions passed an owned operand straight to the
runtime parse, which keeps nothing, so `int(digits(7))` leaked the str.
An owned source is now held across the parse, which raises on a
malformed number, and released after it. (#324)
…l lock
zrt_chan_send and zrt_chan_recv read `w.done` right after the park
returned, without the lock the counterparty writes it under. A park can
end on a wake token an earlier select left standing, while a sender on
another worker is between taking the waiter and setting `done`. A
lockless false then went round the loop, and a receive could overwrite
the value just handed into *out. Both now take the lock first. sched.c's
note that "only select" is woken early now says what it covers: only a
select sets a token for a channel, but a plain op can still be woken by
one. Not reproduced, as #261 says; the fix follows the reading. (#261)
A newline after `{` is offered as a separator token because a block may
open there, so the grammar committed to the block and `{⏎ "x": 1 ⏎}`,
which `zerg fmt` writes, was an ERROR at the `:`. map_literal now accepts
the same token after the `{`, after each `,` and before the `}`. The new
conflict against _statement_separator is the one the generator asks for.
(#356)
Three mem-check cases. map_index_owned covers an owned map, a map read out
of one, an owned key and a missing key under guard (#322, #323).
map_walk_owned covers an owned map walked, broken out of, and a held map
walked (#321). parse_owned covers an owned str parsed as int and uint, a
malformed one under guard, and a held one (#324). All three leaked every
round on the compiler without the fixes.
memory.md (en and zh-TW) said produced strings no longer leak. It now
says what is true, with a [deviation] naming #320, re-measured: the
message of an `Err` built from a run-time str leaks once per discard. The
README's silent-deviation table (en and zh-TW) drops the eager `init()`
row, which its own chapter calls the rule, and gains the #320 row.
(#341)
cmj0121
force-pushed
the
fix/seven-minor
branch
from
October 18, 2026 01:17
ff3156f to
6b8b808
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #322. Closes #323. Closes #321. Closes #324. Closes #341. Closes #356. Closes #261.
Seven small fixes on one branch, at the owner's request. Each issue has its own
fix(ordoc) commit.c_map_indexholds an owned map and an owned key across the lookup, then gives them back. The lookup aborts on a missing key, so the hold matters. The value is taken out before the map is dropped.c_map_ownedrecurses, somkn(7)["a"]["b"]owns the inner map as well.for k in mkm(1)now takes the map it was handed instead of copying it and losing the original.int(s),uint(s)andfloat(s)hold an owned source across the parse and release it afterwards.zrt_chan_sendandzrt_chan_recvreadw.doneunder the channel lock.sched.c's "only select" note now says that a plain op can still be woken by a token a select left standing.map_literalaccepts a newline after{, after each,and before}. One new conflict, which the generator asks for.memory.md(en + zh-TW) no longer says produced strings never leak. A[deviation]names #320, re-measured at one leak per discard. The README table (en + zh-TW) drops the stale eager-init()row and gains the #320 row.Measured
map_index_owned,map_walk_ownedandparse_owned. All three leak every round on a compiler built from main'semit.zg(LEAK … per round unfreed) and are clean with the fix.guard. All clean, with correct output, andleaks --atExitreports 0 leaks.codegen/map_literal_opens_a_lineis RED on the old grammar (ERROR [9, 5]). With the change, all 917 files read.make -C src/runtime test,sanitize-concandsanitize-corpusare green.fix(emit)commit builds.ci.ymlexcept the Linux-only ones.Split out
#356's third Done-when item is the formatter opening
print {"x": 1}across three lines. It is filed as #374.🤖 Generated with Claude Code
https://claude.ai/code/session_01N8jd1oK2orM6diHxhvWhC7