Repository navigation
Slots need a writable receiver (D172); iter_place writes the list it iterates; the C backend emits the compiler again (#2409) - #3565
Merged
Conversation
…iterates; the C backend emits the compiler again (#2409)
This was referenced Nov 23, 2026
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 #2409.
#2409 said the no-LLVM bootstrap stopped at a tuple map key. That stop was already fixed on main; the lane (
:emit-c-test) was in no battery and had since broken further along. Following it found four defects, two of them outside the C backend.1. A safety hole (D172 item 1).
xs.slot(i),xs.iter_place()andxs.get_disjoint(i, j)were read-mode built-ins, so a plainfn, or a function taking&T, could overwrite an element through the slot:D172 rules that a
fnreceiver is read-only for every write through it, andpushwas already refused here. A slot is the handle an element is written through, so making one is the write: the three are nowMut-mode built-ins. The C backend found it: the emitted C passed aconstlist towith_vec_make_unique_bits.fnand wrote through a slot (Sema, ComptimeEval, Lsp, MirCore); they aremut fnnow, rewritten from the compiler's own diagnostics.&Tparameter now gets the message a usermut fngets (it names themutparameter). Three compile-error tests expected the old generic text and now expect the specific one.2. Wrong output on main.
for slot in xs.iter_place(): slot.set(v)never changedxs.lower_for_iter_placelowered the list as a value, a retained copy since lists share their buffer (D120), made the copy unique and wrote into it. It now iterates the list's own place.test/mut_iter_place.withhas failed since; no lane ran it.3. C backend:
ListIter[T]. std declares it as a struct since #2526, but the C backend still listed it as a built-in with a hand-written layout nobody wrote, so its fields came from the instance's argument list (_Alignas(23646) const int32_t* string;).4. C backend: a copy out of a view passed
const T*to the copy glue. A hold reads the record (the holder count is in the buffer), so the call casts.So this cannot rot again
:release-checksnow depends onemit-c-fixpoint(the compiler emitted as C, compiled, and emitting itself to the same bytes). It adds about eight minutes there; the battery is unchanged.test/mut_*.withfiles, run by no lane, move totest/behavior/behav_mut_*.with.Tests (each shown failing before its fix):
err_d172_fn_receiver_writes_through_slot,err_d172_ref_param_writes_through_slot,behav_iter_place_writes_the_list(leak 0),test/emit_c/list_iter_declared_struct.:emit-c-testand:emit-c-fixpointgreen. Battery green (530 s); self-audit and:release-checksgreen (583 s).