ITADN

SourceAnalysis::visit_mod needs to consider inline modules correctly

#1793Openmathstuf 创建于 2025-11-17
M
mathstufcommented
**Describe the bug** If a module has an inline `cfg(test)` module, any module with that inline module's name is automatically ignored even if it is a "live" module due to the way `SourceAnalysis::visit_mod` updates `ctx.ignore_mods`. **To Reproduce** In `src/foo/blah.rs`: ```rust #[cfg(test)] mod over_here { } ``` In `src/foo/over_here.rs`: ```rust mod impl_over_here; ``` Because `src/foo/blah.rs` adds `src/foo/over_here` to the `ignore_mods`, `src/foo/over_here/impl_over_here.rs` is excluded. Spooky action at a distance :) . **Expected behavior** Inline modules should be more careful about adding paths to `ctx.ignore_mods`. I'm not sure of the 100% correct fix (I spent enough time chasing this down that I want to capture it here before thinking about solutions). Of course, once this is fixed, `#[path]` just opens other cans of worms as well.
0 条评论