Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/skills/audit-layout/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ its own `AGENTS.md` maps every file in it.
- In the Unity project an asmdef, not the folder name, decides where an assembly compiles: `Assets/Test/Editor/Model`
and `CrossRef` build for players too and sit under `Editor/` because only the editor tests use them (their
namespaces say `Test.Editor`); move them only together with their namespaces.
- **Preserve the original module and item order when splitting Rust files whose machine code must stay identical.**
Moving impls to child modules can change rustc's codegen-unit partitioning and alter even untouched hot functions
(`DateOnly::new` in #248). Use ordered `include!` fragments when ordinary modules change the instructions.
Compare the release binaries from the same checkout path and flags with the same hot-path implementations on both
sides (`optimize-runtimes`). Check the fragments with `rustfmt --check` as well as `cargo fmt --all --check`,
which does not follow `include!`.

## Adding files that nothing builds

Expand Down
3 changes: 2 additions & 1 deletion .claude/skills/optimize-runtimes/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ metadata:
The techniques that made the Go, Rust and TypeScript runtimes and nino-gen's generated code faster or slower. The
.NET and Unity techniques, reading .NET machine code and the prefetch design of every runtime are `optimize` (prefetch:
its references/prefetch.md). How to measure on runners is `benchmark` (runtime A/B), where the next win is
`audit-perf`, each runtime's rules are `runtimes/*/AGENTS.md` and `audit-runtimes`.
`audit-perf`, each runtime's rules are `runtimes/*/AGENTS.md` and `audit-runtimes`. For Rust source splits that must
keep machine code identical, see [audit-layout](../audit-layout/SKILL.md#splitting-long-files).

## The techniques, by topic

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Format
run: cargo fmt --all --check
run: |
cargo fmt --all --check
# rustfmt does not follow the ordered include! fragments.
rustfmt --edition 2021 --check src/impls/*.rs

- name: Clippy
if: ${{ !cancelled() }}
Expand Down
11 changes: 7 additions & 4 deletions runtimes/rust/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ src/
writer.rs Writer: appends to a Vec<u8>
error.rs the one error type (Error, ErrorKind)
traits.rs the traits generated code implements and calls (NinoRead, NinoWrite, bodies)
impls.rs trait implementation modules, ordered keys and deferred steps
impls.rs shared codec helpers, ordered keys, deferred steps and the ordered codec fragments
impls/numbers.rs primitive numbers and booleans, including their fixed-size blocks
impls/strings.rs String and str
impls/wrappers.rs Option and Box
impls/sequences.rs Vec, slices and VecDeque, including block and prefetch helpers
impls/sequences.rs Vec, slices and VecDeque
impls/sets.rs HashSet, BTreeSet and shared set helpers
impls/maps.rs HashMap, BTreeMap and the map! reader shared with IndexMap
impls/tuples.rs tuples and pairs
Expand Down Expand Up @@ -114,11 +114,14 @@ Generated files: `tests/generated/*` is rewritten by `NINO_UPDATE_GENERATED=1 do
(`type_consts!`); anything the
wire format cannot express is a compile error naming the field, with a case in `tests/compile_fail/`. Give a new
attribute a corpus or derive test.
- Before committing: `cargo fmt --all --check`, `cargo clippy --workspace --all-features --all-targets -- -D warnings`
- Write a macro call's arguments one per line once they hold a bound (`HashMap,` / `fill_hash_map,` / `Eq + Hash`): the rustfmt in CI's `stable` toolchain (November 2026) splits them, while rustfmt 1.9.0 accepts both forms, so a local check passed and main's Runtimes run failed on `map!` in `impls.rs` and `convert.rs` (5a03c0a5).
- Before committing: `cargo fmt --all --check`, `rustfmt --edition 2021 --check src/impls/*.rs` for the included
fragments, `cargo clippy --workspace --all-features --all-targets -- -D warnings`,
and `cargo test --workspace --all-features` with `NINO_CORPUS` set (the conformance, derive and fuzz tests skip
without a corpus), then `cargo test -p nino-serialization --lib --test spec --test values` without features, as
runtimes.yml does: a test there that uses the derive or another feature goes behind `#[cfg(feature = "...")]`
(round 104's `canonical_layout_int128_field` broke that job). `tests/conformance/types.rs` is generated by
`tests/conformance/gen.py`; edit the generator.
Builds share one `CARGO_TARGET_DIR`: Rust targets are large.
- Write a macro call's arguments one per line once they hold a bound (`HashMap,` / `fill_hash_map,` / `Eq + Hash`).
The rustfmt in CI's `stable` toolchain (November 2026) splits them, while rustfmt 1.9.0 accepts both forms.
A local check passed and main's Runtimes run failed on `map!` in `impls.rs` and `convert.rs` (5a03c0a5).
1 change: 1 addition & 0 deletions runtimes/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ still parse from these strings (`FromStr`) and print to them (`Display`).

```sh
cargo fmt --all --check
rustfmt --edition 2021 --check src/impls/*.rs
cargo clippy --workspace --all-features --all-targets -- -D warnings
cargo test --workspace --all-features
```
Expand Down
Loading
Loading