COOLJAPAN
← All posts

SplitRS 0.3.4 Released — Nested-Mod Descent Correctness Hardening

SplitRS 0.3.4 fixes five correctness issues in --split-nested-mods surfaced by a focused review: E0603 visibility widening for relocated private mods, E0425/E0599 parent-scope glob retention, and E0432/E0659 macro-import ambiguity. 570 tests passing. The AST-based Rust refactoring tool for the COOLJAPAN ecosystem.

release splitrs rust refactoring ast developer-tools bugfix

A feature that compiles in the demo isn’t the same as a feature that compiles on every input. 0.3.4 closes the gap between the two for --split-nested-mods.

Today we released SplitRS 0.3.4 — a correctness release. A focused review of 0.3.3’s recursive --split-nested-mods descent turned up five distinct ways the generated code could fail to compile, and all five are fixed.

SplitRS is the AST-based Rust refactoring tool that splits oversized source files into clean, compilable modules: it parses with syn, clusters methods and types, infers visibility, and writes the imports and mod.rs facades for you. No C, no external formatter shelling out to system tools — it links prettyplease in-process and compiles to a single static binary.

Why 0.3.4 matters

Recursive descent multiplies the ways a splitter can get visibility and imports wrong — every level down, super:: paths shift, private items cross new module boundaries, and macro names compete with type names in the same import map. 0.3.4 fixes the five failure modes a targeted review actually found in generated output:

None of this changes the CLI surface — --split-nested-mods, --max-mod-depth, and --facade all work exactly as documented in 0.3.3. This release makes the code they generate compile more often.

Technical Deep Dive

  1. upgrade_type_visibility gains an Item::Mod arm. Visibility widening previously handled types and functions relocated across module boundaries but had no case for inline mod items themselves — so a private nested module, once moved, stayed invisible to the use self::... binding the generator wrote to reach it.
  2. ParentScopeItems (compute_parent_scope_items). Rather than a single “does the parent provide this name” check, the parent-scope analysis now returns a structured result covering both plain provided names and trait methods reachable only via method-call syntax — so step 2 of the descent pipeline can decide to keep the glob import instead of dropping it.
  3. Module::importable_exported_names filters out macro names. The type-to-module import map that drives auto-generated use super::module::Name; lines now excludes anything that is a macro_rules! definition, so macros keep resolving through their normal #[macro_use] path instead of being shadowed by a bogus module-qualified import.
  4. collect_use_bound_names widened pub(super)pub(crate) (src/module_generator/functions.rs) so nested_mod_splitter — a sibling module, not a child — can call it to enumerate exactly which bindings a generated mod.rs needs to recreate for its own descended children.
  5. Five new regression tests, one per review finding, plus a rustc compile probe wired directly into the main nested-mod end-to-end test — so a future regression here fails a test, not just a downstream cargo build.

Getting Started

Install the latest SplitRS:

cargo install splitrs

Recursive descent works exactly as in 0.3.3 — you don’t need to change any flags to get the fixes:

splitrs \
  --input src/large_file.rs \
  --output src/large_file/ \
  --split-nested-mods true \
  --max-mod-depth 4

If you hit E0603, E0425, E0599, E0432, or E0659 against generated mod.rs output on 0.3.3, upgrading to 0.3.4 and re-running the same command should resolve it without any config changes.

What’s New in 0.3.4

Tips

This is the foundation

SplitRS remains the development workhorse behind the COOLJAPAN policy of keeping every file under 2,000 lines, used across the ecosystem’s Rust codebases — OxiZ, NumRS2, SciRS2, and dozens of oxi* crates — whenever a module outgrows its budget. 0.3.4 is a small release by line count, but it’s the kind of hardening that keeps recursive descent trustworthy as a default, not just a demo-able flag.

Repository: https://github.com/cool-japan/splitrs

Star the repo if you want a refactoring tool that treats “the generated code doesn’t compile” as a bug worth a dedicated release. Pure Rust refactoring is here — fast, safe, and increasingly battle-tested.

KitaSan at COOLJAPAN OÜ July 7, 2026

↑ Back to all posts