fix(rust): an array literal where a Vec is declared is a vec! - #3350
Merged
Conversation
gHashTag
enabled auto-merge (squash)
September 6, 2026 04:01
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This was referenced Sep 6, 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 #3349
The headline is the measurement, not the fix. Three emitter repairs in a row measured +0 on the Rust column while demonstrably correcting the emission. The reason is structural and had never been measured.
Real rustc errors per failing spec, over 243:
Median 4. A fix flips a spec to OK only when it closes that spec's last error, so targeting the largest first-error class is the wrong rule — the big classes are spread across specs that each carry several more defects. The right target is the class that is the sole error in one of the 55:
expected one of …7,cannot find type7,mismatched types5,expected type, found keyword5,use of moved value3.The count had to be taken twice.
grep -cE '^error'also matcheserror: aborting due to N previous errors, which inflates every bucket by one and turns 55 specs with one error into zero specs with one error — the exact opposite conclusion, and the one I wrote down first.The fix itself is narrow:
var xs : []u32 = [];maps its type toVec<u32>and emits its value as[]. Nine of the twentymismatched typesfirst-errors are that pair. This closes the local position, the only one of its three with an unambiguous answer;return []andpub const N: Vec<u32> = [...]are the other two, and aVeccannot be a constant in Rust at all — that one is a question about the type mapping, not about the line.Measured, two pinned binaries of distinct hashes: 338 both sides, zero regressions, first error moved on 1 of 14. One predicate, two call sites —
gen_fncarries its own copy of the local-emission logic, as #3341 found the hard way.