fix(rust): undefined is a declaration, not a value - #3341
Merged
Conversation
gHashTag
enabled auto-merge (squash)
September 5, 2026 20:07
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
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 #3340
cannot find value \undefined`was the largest single name in the corpus's first-error census — **14 of 21** in its class — and every one of them sat in the same position:let mut x: T = undefined;`.The emitter already writes the right thing three lines up, for the no-initialiser case. So the repair is to treat
undefinedas no initialiser, not to invent a value.Why not
Default::default(). That was tried and withdrawn (#3223) because[usize; 256]has noDefault. The blocker was the mapping, not the defect. Deferred initialisation needs no bound, and it is the exact semantics: Zig says "uninitialised", Rust says "declared, assign before use".github/auth.t27now reportsE0381: partially assigned binding— a real defect surfaced where a default would have swallowed it.Two call sites, not one.
gen_fncarries its own copy of the local-emission logic. The first attempt patchedgen_rust_stmtalone and changed no output at all — the fix did not travel inside a single emitter, one scope smaller than the emitter-to-emitter gaps this corpus is full of. There is now one predicate,is_undefined_init, and two callers.Measured, two pinned binaries of distinct hashes over 651 specs: 336 OK both sides, 245 FAIL, 69 NOGEN — zero regressions. The column does not move.
What moves: the first rustc error changed on 13 of 14. The fourteenth is
vsa/similarity_search.t27, apub static mut xs: [T; N] = undefined;— named as untouched before the measurement, because a static cannot be uninitialised in Rust. The predicted exception is the only one.