STRA-338 S12c: fns and impl blocks of 162 hot-path modules move into child modules (leleka-runtime, cuda-driver, deploy, cpu-sys)
The same lexer-based splitter as S12b, now with explicit re-exports: every moved free fn comes back to its module under its old name and old visibility (cfg attributes carried), so a name can never clash with another glob import. 162 module files of leleka-runtime (68), cuda-driver (84), deploy (10), cpu-sys, igpu and leleka-memory are split into groups of about 250 lines; types, constants, macros, nested modules and tests stay. Not touched: the files kar-off-ab edits, crate roots (lib.rs, main.rs, bin/*), and giant single impl blocks (next). This changes codegen-unit placement of engine code, so it is covered by the bitwise replay and the paired A/B on the 5090, not by a binary comparison.
This commit is contained in:
@@ -119,7 +119,13 @@ class Planning(unittest.TestCase):
|
||||
self.assertEqual(sum(len(re.findall(r"fn \w+[(<]", text)) for text in children.values()), 5)
|
||||
self.assertTrue(all("use super::*;" in text for text in children.values()))
|
||||
for name in children:
|
||||
self.assertIn(f"mod {name};\n#[allow(unused_imports)]\npub use {name}::*;", parent)
|
||||
self.assertIn(f"mod {name};", parent)
|
||||
self.assertIn("use helper_fn::helper;", parent)
|
||||
self.assertIn("pub(crate) use shared_fn::shared;", parent)
|
||||
|
||||
def test_cfg_attributes_follow_the_fn_to_its_use(self):
|
||||
parent, _ = plan_split('#[cfg(unix)]\npub fn a() {}\n', 100)
|
||||
self.assertIn('#[cfg(unix)]\n#[allow(unused_imports)]\npub use a_fn::a;', parent)
|
||||
|
||||
def test_nothing_to_move_gives_none(self):
|
||||
self.assertIsNone(plan_split("use a::b;\nconst X: u8 = 1;\n", 100))
|
||||
@@ -131,7 +137,7 @@ class Planning(unittest.TestCase):
|
||||
|
||||
def test_explicit_paths_are_written_for_path_loaded_files(self):
|
||||
parent, _ = plan_split("fn a() {}\n", 100, explicit_dir="foo")
|
||||
self.assertIn('#[path = "foo/a.rs"]', parent)
|
||||
self.assertIn('#[path = "foo/a_fn.rs"]', parent)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user