fix(rust): []const u8 in a const is owned, and the argument is thirty lines above (+1) - #3259
Merged
Merged
Conversation
… lines above (+1) The `str` arm was given the borrowed form today and its comment argues the case -- "neither `[]const u8` nor `const char*` owns its bytes". The very next arm sends the literal `[]const u8` spelling down the owned path, so a const declared with it came out as `pub const SPDX_HEADER: Vec<u8> = "..."`, which is `expected Vec<u8>, found &str`, and a Vec cannot be built in a const at all. Keyed on the `const` QUALIFIER, not the element type. I probed the broad version earlier and declined it at +1/-1: the regression was opcodes.t27, whose `chain: []u8` is indexed as `chain[(idx) as usize]` and cannot be a str. A plain `[]u8` keeps Vec<u8>, verified in the output. A declined probe is not a dead end -- its regression measured where the rule ends. Measured against master: 329 -> 330, +1, zero regressions. The Zig backend already writes `const SPDX_HEADER: []const u8` and zig build-obj accepts it. Found by a nine-agent fan-out against a pinned binary, after an earlier run of the same audit was discarded because I rebuilt the compiler underneath it. The agent rebuilt the 329/252/69 baseline itself before trusting it, and regression-tested the one-arm alternative across all 24 accepted files containing Vec<u8>: 0 broken. Closes #3258 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
September 5, 2026 09:03
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
# Conflicts: # .trinity/seals/SDK.json # .trinity/seals/cli_gen_commands.json # .trinity/seals/gen_commands.json # .trinity/seals/vsa_SDK.json # bootstrap/stage0/FROZEN_HASH
…s DIRTY) Control before pushing: the change is verified present in the rebuilt binary. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
PR DashboardGenerated at: 2026-09-05 09:14:43 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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.
The argument for treating this spelling as borrowed is already written thirty lines
above, on the
strarm:That arm was given
&'static strearlier today. The very next arm sends the literal[]const u8spelling down the owned path, so a const declared with it came out as—
expected Vec<u8>, found &str, and aVeccannot be built in aconstat all.Seventh instance this pass of one shape: a rule that exists in one place and did not
travel. This one did not even have to travel between emitters — it is thirty lines.
Keyed on the qualifier, and a regression is what located the boundary
I probed the broad version earlier and declined it: mapping both
[]const u8and[]u8measured +1 / −1. The regression wasspecs/igla/race/opcodes.t27, whosechain: []u8is indexed aschain[(idx) as usize]and cannot be astr.[]u8is a mutable byte buffer and keepsVec<u8>. Only theconst-qualifiedspelling becomes borrowed. Verified in the output:
opcodes.t27still emitschain: Vec<u8>.Measured against master
49c11fc3c)The Zig backend already writes
const SPDX_HEADER: []const u8 = "…"andzig build-objaccepts it;gen-cwrites a#define, which erases the type rather thananswering it.
Provenance
Found by a nine-agent fan-out against a pinned binary (
/tmp/t27c-pin2, shab6f3bf14a764722f), after an earlier run of the same audit was discarded because Irebuilt the compiler underneath it. The agent rebuilt the 329/252/69 baseline itself
before trusting it, regression-tested the one-arm alternative across all 24 accepted
files containing
Vec<u8>(0 broken), and reported thehelp: call Into::intosuggestion trap explicitly.
Refs #3239
Closes #3258