Skip to content

fix(rust): a use through a module with a file per cfg reaches the item one file holds - #3184

Merged
colbymchenry merged 1 commit into
mainfrom
claude/fix-rust-cfg-module-choices
Nov 1, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
claude/fix-rust-cfg-module-choices

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

tokio's use crate::process::unix::GlobalOrphanQueue; linked nothing on
main, where 1.6.2 linked it. Since PR #3014 a use path walks the crate's
modules, and tokio's mod unix { pub(crate) use super::imp::*; } globs a
module with a #[path] for each cfg: unix/mod.rs or windows.rs.
rustSubmodule answered null for such a module, so the glob couldn't be
followed and the import had no target.

The fix: rustSubmodule keeps every file the alternatives name
(RustModule.choices), and rustCfgChoiceItems looks a name up in all of them.
What one alternative holds is that one's, whichever the build takes; a name
two of them hold is the build's choice and stays unread, as PR #3064 pinned.
A step further down the path walks each alternative the same way.

Validation:

  • rust-path-attribute-modules.test.ts: 2 of its new cases fail on main and
    all 9 pass.
  • A/B against main 4499d00: tokio +7 imports, all true (the reported edge,
    Wait and OrphanQueue through imp::orphan, AtomicU64 through tokio's
    cfg'd imp), and 2 calls keep their target by the import instead of by
    name. ripgrep, clap, serde, dioxus, gleam and axum byte-identical (axum's
    24 "moved" are the diff tool's duplicate route nodes, identical by row);
    controls flask and express identical.
  • CPU, dioxus, median of 5 interleaved: 33.97 to 33.28 s. Resolution only, so
    no kernel change.

Suite: 874 files passed, 6 skipped; 10,847 tests passed, 2 expected fail, 87 skipped, with the kernel on Windows, on the stack of these 8 PRs at 00b79ff2 over main 1f188da. The A/B numbers are against 4499d00; the stack on 1f188da is edge for edge the same arm on jsoup, rocksdb's java/, Minestom, okhttp, tokio, caddy, Alamofire, nowinandroid and mihon, and those repos give the same graph on both mains.

🤖 Generated with Claude Code

…m one file holds

tokio's `use crate::process::unix::GlobalOrphanQueue;` linked nothing on
main, where 1.6.2 linked it. Since PR #3014 a `use` path walks the crate's
modules, and tokio's `mod unix { pub(crate) use super::imp::*; }` globs a
module with a `#[path]` for each cfg: `unix/mod.rs` or `windows.rs`.
rustSubmodule answered null for such a module, so the glob couldn't be
followed and the import had no target.

The fix: rustSubmodule keeps every file the alternatives name
(RustModule.choices), and rustCfgChoiceItems looks a name up in all of them.
What one alternative holds is that one's, whichever the build takes; a name
two of them hold is the build's choice and stays unread, as PR #3064 pinned.
A step further down the path walks each alternative the same way.

Validation:
- rust-path-attribute-modules.test.ts: 2 of its new cases fail on main and
  all 9 pass.
- A/B against main 4499d00: tokio +7 imports, all true (the reported edge,
  `Wait` and `OrphanQueue` through `imp::orphan`, `AtomicU64` through tokio's
  cfg'd `imp`), and 2 calls keep their target by the import instead of by
  name. ripgrep, clap, serde, dioxus, gleam and axum byte-identical (axum's
  24 "moved" are the diff tool's duplicate route nodes, identical by row);
  controls flask and express identical.
- CPU, dioxus, median of 5 interleaved: 33.97 to 33.28 s. Resolution only, so
  no kernel change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@colbymchenry
colbymchenry merged commit 221d80c into main Nov 1, 2026
@colbymchenry
colbymchenry deleted the claude/fix-rust-cfg-module-choices branch November 1, 2026 09:33
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