decisions DECIDED

295. The line editor's crate root splits into module files

Raised 2026-10-12 (UTC) as the cut that milestone 878 (the line editor's inline modules move to their own files) says is calef's call before a line moves. Written by lane milestone/878-the-line-editors-inline-modules-move-to-their-own-files. (Section number provisional until the merge queue lands it.)

It blocked the move and nothing else.

The ruling

calef asked nothing separate on this section. The block's three questions are answered by decisions he had already made, and the maintainer recorded that on 2026-10-12 at 02:58 (UTC) on PR #1969: "Settled by precedent; nothing asked."

  1. By module, or tests only: by module. calef chose the code over the tests alone in §275 (the file server core's tests move into child modules by topic) and §274 (the filesystem-protocol crate root splits into its module files), and proto, component and handoff are already modules.
  2. Whether the editor's 46 tests stay in lib.rs: no. Under §282 (when a file is split, the parent becomes an index), a crate root that declares a child holds only docs, mod lines, use and re-exports. LineDisc leaves too, and its tests go beside it in the shape §274 ruled: x.rs ends with #[cfg(test)] mod tests;, and the tests live in x/tests.rs.
  3. File names were not asked. They ship provisional for calef's naming pass, as every split since §279 (the system-initializer crate root splits into private modules) has.

The layout below therefore goes further than the block's, which kept LineDisc and RawQueue in a 1,540-line lib.rs. §282 was decided after the block was written.

What the file was

crates/line_editor/src/lib.rs was 2,290 lines on main at 17b23264e: 144 lines of crate docs, three inline public modules (proto, component, handoff), the editing engine, the raw queue, the output side, and mod tests with 54 tests.

The layout

file holds lines
lib.rs crate docs, the three public modules' docs on their pub mod lines, mod lines, re-exports 198
line_disc.rs LINE_MAX, HIST, PROMPT_MAX, Event, LineDisc, the cursor-move helpers 541
raw_queue.rs RAW_QUEUE_MAX, RawQueue 82
output.rs Sink, expand_output 35
proto.rs, component.rs, handoff.rs each module's body 186, 171, 166
x/tests.rs for line_disc, handoff, raw_queue, proto, output 40, 6, 4, 3 and 1 tests 18 to 576
test_support.rs Screen and feed_all, the terminal model the tests share 105

line_disc, raw_queue and output are private. lib.rs re-exports their public items by name, the 842 pattern, so every line_editor:: path the 40 Rust files outside the crate name resolves as before. The three public modules keep their paths. Their docs stay as /// on the pub mod line, as §274 kept them, so no doc text changed and its links still resolve from the crate root.

A test goes beside the module it tests, by §274's rule: beside x when every other module it names is one x names. The six handoff tests drive a LineDisc and a RawQueue, which handoff names, so they are handoff's. Two of them use the editor tests' terminal model, which therefore moves out of any one test module into test_support.rs, as milestone 872 (the kernel's user-mode file is split along its seams) did. The block counted two proto tests; a third, that the two start bits are distinct low bits, names only proto and joins them.

What the move needed beyond moving lines

What else was considered

Records that follow the move

What it does not decide

No public path, wire format, layout or system call changes. Every new module and file name is provisional.