# 001 — Fix `use` keyword in `mod_interface!` not propagating child layer items
## Status: ✅ Done
- **ID:** 001
- **Priority:** 8
- **Executor:** any
- **Advisability:** 1944
- **Value:** 9 / Easiness:** 5 / Safety:** 3
- **Completed:** 2026-04-17
## Purpose
`mod_interface!{ use super::layer_a; }` is supposed to pull all re-exported items from
`layer_a` into the parent module's visibility layers (`orphan`, `exposed`, `prelude`, `own`).
Instead the generated re-exports are missing — 121 E0425 errors across tests and examples.
## Context
The `use` keyword inside `mod_interface!` is a declarative directive meaning:
"import this child module's mod_interface-exported items into my own layers."
Example: parent module declares `use super::layer_a` — `layer_a` itself has
`mod_interface!{ orphan use PrivateStruct1; orphan use SubStruct2; }`.
Expected: `parent::orphan::PrivateStruct1` resolves.
Actual: E0425 — `PrivateStruct1` not found in `orphan`.
The compiler suggests `use crate::child::prelude_thing` (the item exists in the child's
layers) but denies access via the parent's layers — the cross-module re-export chain
generated by the macro is broken.
## Affected Files
**Example (11 errors):**
- `examples/mod_interface_trivial/src/main.rs` — asserts `prelude_thing`, `exposed_thing`,
`orphan_thing`, `own_thing` accessible via parent's `prelude`/`own`/`orphan`/`exposed`
**Tests (110 errors) — all in `tests/inc/`:**
- `derive/layer_have_layer_separate_use/mod.rs` + `only_test/layer_simple_only_test.rs`
- `derive/layer_have_layer_separate_use_two/mod.rs` + same only_test
- `derive/layer_use_cfg/mod.rs` + same only_test
- `derive/use_as/derive.rs` + `only_test/layer_single_only_test.rs`
- `derive/use_basic/mod.rs` + `only_test/layer_simple_only_test.rs`
- `derive/use_layer/mod.rs` + `only_test/use_non_layer_only_test.rs`
- `manual/layer/layer_a.rs`, `manual/layer/layer_b.rs`
Error counts: 121 total (11 example + 110 tests).
## Root Cause
Previous `record_use_implicit` in `mod_interface_meta/src/impls.rs` re-exported
`pub use super::child` into all four layer clauses (own, orphan, exposed, prelude)
unconditionally. This only exported the module itself — never the child's items.
The correct behavior requires layer-aware propagation:
- `child::orphan::*` → parent's `own_clause` (parent-private; does not cascade out)
- `child::exposed::*` → parent's `exposed_clause` (cascades to orphan+own+root)
- `child::prelude::*` → parent's `prelude_clause` (cascades to all layers)
- Module reference → parent's `own_clause` (enables `own::child` access)
Simple-item paths (`private_prefix_is_needed() == true`) retain all-four-layers behavior.
## Fix Applied
Rewrote `record_use_implicit()` in `mod_interface_meta/src/impls.rs` (lines 168-257):
- Branched on `path.private_prefix_is_needed()` to distinguish module paths from simple items
- Module paths get layer-aware propagation matching `record_layer` semantics
- Rename handling (`use super::X as alias`) mirrors `record_reuse_implicit` pattern
- Return type changed to `syn::Result<()>` for error propagation
## Validation Criteria (Done When)
- [x] `cargo build -p mod_interface --example mod_interface_trivial --all-features` → exit 0
- [x] `cargo nextest run -p mod_interface --all-features` → 26/26 passed, 0 E0425 errors
- [x] `cargo clippy -p mod_interface --all-targets --all-features -- -D warnings` → exit 0
- [x] `cargo clippy -p mod_interface_meta --all-targets --all-features -- -D warnings` → exit 0
## Notes
- The `meta_tools` crate (which includes `mod_interface` tests via `#[path]`) also
passes L3 after this fix: 67/67 tests, 0 clippy warnings.
- Safety rating 3 was warranted — the fix required understanding the full layer cascade
model (`prelude → exposed → orphan → own → root`) to get propagation mappings right.