Repository navigation
The standard library takes fix-ceremony's rewrites; the tool no longer trusts code this target did not check; the compile-time evaluator stores into a field of a let (part of #3061) - #3601
Merged
Conversation
added 3 commits
November 24, 2026 13:40
Contributor
Author
|
Windows (VM, at b6aaf32, which is this branch plus the emit-C link fix): |
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.
Part of #3061 (and of #2519's first item). Both stay open.
Sweeping
lib/stdwithwith fix-ceremonyfound three defects. They are fixed here, before the sweep.1. The tool trusted code this target never checked (a platform hazard)
The comptime transform keeps one arm of a
comptime if/comptime matchand Sema never sees the others. A fact of the form "nothing else uses this name" therefore did not cover them:was reported as "
varis never rebound", the rewrite toletpassed the Mac re-check, and Windows would have stopped compiling. The same for an index loop whose counter is used only in such an arm. The rewriter now finds the ranges a file's compile-time branches cover and withholdsvar→letwhen the name is written in one, and the index-loop rewrite when one lies inside the loop.src/has no such branches, so the earlier sweeps of the compiler were not exposed;lib/stdhas many.2. A
varwritten through&raw mutwas "never rebound"var n = 0; fill(&raw mut n)lost itsvar. Sema now records the address-of as a write.3. The compile-time evaluator refused what Sema accepts
let out = self; out.output = pathruns, but evaluated at compile time it was "cannot assign to field of immutable value". The sweep turned such avarintoletinlib/std/build.with, which build evaluation interprets, and 41 build-layer tests went red.letforbids rebinding the name, not a store into a field of its value (xs.push(…)on aletalready evaluated). The evaluator re-derived Sema's answer and got it wrong; the refusal is removed (D65).The sweep
Each of the 91 files outside the migrated engines as its own entry,
--std --check-with src/main; none restored. 38 files change:varnever rebound →letaswhere the context widensList.new()/HashMap.new()where the type is demanded or written →[]/[:]&xat a&Tparameter.clone()on a str,Some(x)under an Option demandFour files do not check as their own entry and are untouched (
builtins,result,string,traits).Tests:
test/internals_compiler/ceremony_fix_test.withgains a sample with a Windows-only assignment, a Windows-only counter use and a&raw mutwrite (one rewrite, not three);behav_comptime_field_store_into_let. Both fail on main.Evidence at c2ba7a0
:unit-return-review,:ceremony-census,:self-audit,:behavior-tests,:internals-compiler-testsgreen; battery green;:release-checkssurvey: all targets green.:behavior-tests,:internals-compiler-testsgreen.:buildgreen on this content.