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
Rust adapter: accept literal #[path] modules inside their own crate #226
Any #[path] attribute makes a file fall back today (Rust computed includes or path attributes require full validation), so the whole repository runs everything. But platform modules written this way are common in real crates:
This pattern shows up in mio, socket2, getrandom, parking_lot_core and many others, in their own source and wherever they're vendored.
When the attribute is a plain literal on a file module (mod name;) and points inside the same crate, the adapter can check it the same way it checks include!. The rules are the Rust reference's: relative to the file's directory, and inside inline mod x { … } blocks also relative to their names. The target file is already a source of the crate, so crate-granular selection stays correct.
Proposal:
Accept #[path = "lit"] and #[cfg_attr(pred, path = "lit")] on mod name; when every target resolves (realpath'd) to a tracked .rs file owned by the same package.
Add each target's directory to the inventory check, because its own mod declarations are looked up from there.
Keep falling back for:
paths outside the crate or missing files;
#[path] on inline modules;
#![path];
non-literal paths;
#[path] inside an inline module of a file that isn't a crate root or mod.rs, where the base depends on how that file was itself loaded. A path-loaded file acts like mod.rs, which I checked with rustc.
Activity
feat(rust): accept literal #[path] modules inside their own crate (Di…