You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tools/sweep_gate_corpus.w does not compile: bare extern calls, str-Copy if, argv borrow #1068
At 450733e, the committed sweep-gate tool fails under its canonical invocation:
$ out/bootstrap/bin/with-stage1 run tools/sweep_gate_corpus.w
error: manual extern function call requires unsafe context
--> tools/sweep_gate_corpus.w:21:17
21 | for line in with_fs_read_file(diag_path).split("\n"):
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: if would need to copy a `str`, which is not Copy
--> tools/sweep_gate_corpus.w:32:35
32 | let d_corpus = if argv.len() > 4: argv.get(4) else: ""
| ^^^^^^^^^^^
error: manual extern function call requires unsafe context
--> tools/sweep_gate_corpus.w:37:10
37 | for f in with_fs_read_file(list_file).split("\n"):
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(plus further errors below the head cut). Reproduced identically under the tree-built stage2, so it is not a stale seed. Probable repair: wrap the extern calls in unsafe:, thread &str through gate_count, clone the argv.get(4) arm (the owned(...)/++ "" idiom used by drop_audit/move_audit).
Verdict. Reproduced: tools/sweep_gate_corpus.w does not compile. All three reported errors occur on the reported revision and on current main: two manual extern function call requires unsafe context on the bare with_fs_read_file calls, and one if would need to copy a str, which is not Copy on the argv.get(4) ternary. It is a stale internal tool, same family as #1066/#1067.
Tested.
Source
main @ 5809ac1 (2026-09-14); tools/sweep_gate_corpus.w unchanged since it was committed (7d8d085), pre-dating the reported revision 450733e
Compilers
with v0.15.2.1 built from 5809ac1 (staging worktree); a compiler built from 450733e with the nightly-20260903 seed (3/3 errors)
Platform
macOS Darwin 25.6.0 arm64
with run tools/sweep_gate_corpus.w, both compilers:
error: manual extern function call requires unsafe context --> :21:17 (with_fs_read_file)
error: if would need to copy a `str`, which is not Copy --> :32:35 (argv.get(4))
error: manual extern function call requires unsafe context --> :37:10 (with_fs_read_file)
let d_corpus = if argv.len() > 4: argv.get(4) else: "" (:32): the two arms have different ownership (a &str view vs an owned literal), and str is not Copy, so the if cannot yield an owned str without a clone.
No compiler defect; the errors are the checker correctly enforcing the unsafe-extern rule and str non-Copy semantics. Established by the run above.
Severity. Low: an internal sweep-gate tool that does not run. No user-facing impact.
Related.#1066 (lib/test harness), #1067 (rt_in_unit_sweep.w) — same "committed tool has rotted" family. std.fs.read_file now returns Result[str, IoError] (lib/std/fs.w:74, per #953/#909), so a migration must handle the Result.
Recommendation — champion, mechanical. Replace the with_fs_read_file extern + calls with std.fs.read_file (unwrapping the Result), and clone the argv.get(4) arm (the owned(...) / ++ "" idiom used by drop_audit/move_audit), exactly as the report suggests. Also thread &str through gate_count to avoid copying the path. Acceptance criteria: with run tools/sweep_gate_corpus.w <stage1> <list> <diag_tmp> runs; no bare with_fs_* extern remains in the tool.
Blockers / not tested. I fixed nothing (read-only) and did not exercise the tool's gate logic beyond the compile failure; there are further errors below the head cut, consistent with the same two idioms. Linux/Windows not exercised.
Activity
ehartford commentedon Sep 16, 2026
Review: reproduced
Verdict. Reproduced:
tools/sweep_gate_corpus.wdoes not compile. All three reported errors occur on the reported revision and on currentmain: twomanual extern function call requires unsafe contexton the barewith_fs_read_filecalls, and oneif would need to copy a str, which is not Copyon theargv.get(4)ternary. It is a stale internal tool, same family as #1066/#1067.Tested.
main@ 5809ac1 (2026-09-14);tools/sweep_gate_corpus.wunchanged since it was committed (7d8d085), pre-dating the reported revision 450733ewith v0.15.2.1built from 5809ac1 (staging worktree); a compiler built from 450733e with the nightly-20260903 seed (3/3 errors)with run tools/sweep_gate_corpus.w, both compilers:Root cause. Two stale idioms:
extern fn with_fs_read_file(path: &str) -> str(:9) and calls it in ordinary context (:21,:37); a manual extern call now requiresunsafe. This is also the D30-deprecatedwith_fs_*seam that user/tool programs should not declare (per AGENTS.md; it SEGFAULTs in user programs, extern fn with_fs_read_file segfaults in user programs (D30-transitional seam) — std.fs works; CLAUDE.md still recommends the broken idiom #901). The right form isuse std.fsandread_file.let d_corpus = if argv.len() > 4: argv.get(4) else: ""(:32): the two arms have different ownership (a&strview vs an owned literal), andstris notCopy, so theifcannot yield an ownedstrwithout a clone.No compiler defect; the errors are the checker correctly enforcing the unsafe-extern rule and str non-Copy semantics. Established by the run above.
Severity. Low: an internal sweep-gate tool that does not run. No user-facing impact.
Related. #1066 (
lib/testharness), #1067 (rt_in_unit_sweep.w) — same "committed tool has rotted" family.std.fs.read_filenow returnsResult[str, IoError](lib/std/fs.w:74, per #953/#909), so a migration must handle the Result.Recommendation — champion, mechanical. Replace the
with_fs_read_fileextern + calls withstd.fs.read_file(unwrapping theResult), and clone theargv.get(4)arm (theowned(...)/++ ""idiom used bydrop_audit/move_audit), exactly as the report suggests. Also thread&strthroughgate_countto avoid copying the path. Acceptance criteria:with run tools/sweep_gate_corpus.w <stage1> <list> <diag_tmp>runs; no barewith_fs_*extern remains in the tool.Blockers / not tested. I fixed nothing (read-only) and did not exercise the tool's gate logic beyond the compile failure; there are further errors below the head cut, consistent with the same two idioms. Linux/Windows not exercised.
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce.