Skip to content

test: gate unused-mut allow on non-unix for issue2071 stem (Refs #3515) - #3523

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix-3515-unused-mut-issue2071
Nov 14, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix-3515-unused-mut-issue2071

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

根因

tests/issue2071_test_empty_path_regressions.rs:104 的 let mut cells 在 Windows 下未被使用:唯一一处可变借用是 :125 的 cells.extend_from_slice(...),它包在 #[cfg(unix)] 块里;Windows 编译时该块被裁掉,mut 遂成 unused-mut,RUSTFLAGS="-D warnings" 下该 stem 编译失败(X299 base 复现:error: variable does not need to be mutable,-D unused-mut implied by -D warnings,rc=101)。

修法

把 6 个 unix-only 行直接移进 vec![] 字面量、每行加 #[cfg(unix)],删掉 mut 与 extend_from_slice 调用。unix 面行集合不变(同 6 行、同顺序),Windows 面行集合不变(仍无这 6 行)。不 suppress lint、不留死 mut。

注意:不能只删 mut(unix 面仍需可变借用做 extend,会报 E0596);本修法把 extend 本身去掉,故两面都干净。

修法来源:前棒车道(08:5x 轮)已在 X299 上写出此 patch 并跑通 Windows 全腿,本轮认领其修法、落到当前 tip(48175205)提交并开 PR;该文件在前棒 base(9410bc9f)与现行 tip 间无任何改动,Windows 证据直接转移。

本 PR 删除了什么

删除 let mut 中的 mut 与 #[cfg(unix)] cells.extend_from_slice(&[...]) 调用(5 行删、11 行增,净 +6 行;6 个 unix 行以 #[cfg(unix)] 形式保留在字面量内)。未删除任何测试与用例。产品语义零改动。

验收

  • Windows(X299-2607,MSVC 原生,cargo/rustc 1.99.1):base fail-first 红(见上);本分支 RUSTFLAGS="-D warnings" 下 stem 测试 6/6 通过、error/warning 行 0;引擎 RUSTFLAGS="-D warnings" cargo check --locked --lib --bins rc=0、0 error/warning;cargo fmt --check rc=0(前棒 stage1/stage2 日志,X299 work/r3515-logs/;本轮在分支内容上重跑确认)。
  • Linux(老服务器):base 上该 stem 本就干净(mut 被使用);本分支同样干净、测试照常跑;cargo fmt --check 逐文件。

UNVERIFIED-BY-CAPTAIN

#3515)

cells at tests/issue2071_test_empty_path_regressions.rs:104 was extended
only under #[cfg(unix)] (:125 extend_from_slice), so on Windows the
mut was unused and -D warnings failed the stem. Move the six unix-only
rows into the vec! literal with per-element #[cfg(unix)] and drop the
mut (and the extend) instead of suppressing the lint: a bare drop of
mut alone would break the unix build (E0596), and a cfg-gated allow
would leave the dead mut in place.
@caomengxuan666
caomengxuan666 force-pushed the fix-3515-unused-mut-issue2071 branch from b6ecbf2 to 9e6a4ac Compare November 14, 2026 01:56
@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核 PASS

结论:合入。 Refs-only,合入后队长手关 #3515。

Diff(已核对原文): 1 文件 +11/−5,tests/issue2071_test_empty_path_regressions.rs:let mut cells 去 mut,删 #[cfg(unix)] cells.extend_from_slice(...) 调用,6 个 unix-only 行(link -L/-h/-f/-e、somefifo -p/-f)移进 vec![] 字面量并逐行加 #[cfg(unix)]。未用任何 #[allow];无用例删减(unix 面 6 行同顺序,Windows 面仍无这 6 行),无产品语义改动。标题中 "allow" 一词与实际改法不符,仅为 nit,不构成 FAIL。

腿(~/workspace/review-3523/legs/,日志已从盘核验,零 VOID):

  • 钉双边(bin-first):头 6/6 = 基底 6/6,逐名一致。
  • lib 双边(bin-first):头 1246/0/4 = 基底 1246/0/4,失败名集 ∅。
  • -D warnings 强制重查(头):rc=0,48 次 rustc 调用(非空闲),0 诊断。
  • 卫生:git diff --check、rustfmt --check 均 rc=0。

CI(run 43543511493,失败日志原文已核): 3 红 job(GNU 1349/1/4、macOS 1242/1/4、Linux Rust tests 0/1)唯一失败名均为 issue2875(#3292 基线);决定性面 Windows tests compile check PASS,API tripwire PASS。钉 stem 在 CI 日志中 0 提及(#3430 型缺口),本轮腿已补齐。正文所称 X299 全腿为作者自报,未独立复核——Windows 面以 CI 编译检查为准。

交集: merge-base 48175205..live tip e796c73b(队长重算,含 #3519),0 个文件触及 issue2071——零交集例外成立,无需 update-branch。

删除节: 正文已有(删 mut 与 extend 调用,未删测试与用例),与 diff 一致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant