pub enum ModScope {
Prod,
Test,
}Expand description
Prod/Test scope discriminant for PureMod.
2-value enum. #[cfg(test)] 専用 SoT primitive.
ModScope is the sole source of truth for whether a module is test-scoped.
No downstream layer (store, regen, emitter) may re-derive Prod/Test scope by
inspecting raw attrs or items.is_empty(); each layer must consume this field
directly.
非 binary cfg (cfg(not(test)) / cfg(feature="...")) は ModScope::Prod に保持しつつ、
元の cfg attribute は PureMod.attrs に残し透過 emit する。将来拡張需要が出た場合は
ModScope に variant を追加する設計に拡張可能。
ryo_suggest::suggest::SymbolScope (Lib/Bin/Test) とは意味論軸が直交
(AST primitive vs post-hoc classification)。統合は本 Issue scope 外。
Variants§
Prod
Production code: module is not gated by #[cfg(test)].
This is the default. Modules with non-binary cfg gates
(cfg(not(test)), cfg(feature="...")) are also represented as Prod
with the original cfg attribute preserved in PureMod.attrs.
Test
Test code: module is gated by #[cfg(test)].
The #[cfg(test)] attribute is removed from PureMod.attrs at parse
time and re-injected by the emitter (ToSyn for PureMod).