Commit 42aed47
mm0b_parser: pin the fixture's index format, and say why AlignFile is align(8)
The two fixes these tests were written alongside are already here: `e820dc3f`
made `AlignFile` `align(8)` and regenerated `test_resources/peano.mmb` as part
of the CI work, and the fixture bytes are identical to the ones regenerated on
`mmb-explorer`. What did not come with them is the coverage and the reasoning,
picked up here from that branch (`65933edd`, `00d19428`).
`peano_index` parses the fixture *with* its index and checks that names
resolve. `peano0` parses it as a `BareMmbFile`, which ignores the index
entirely, so it kept passing while the fixture's index went a format version
behind — which is how the fixture came to be stale unnoticed. A test that never
looks at the index cannot report one that has rotted.
The `AlignFile` doc comment records why it must be `align(8)` and not
`align(1)`: `repr(align(N))` only ever raises a type's alignment, so `align(1)`
on a `[u8; N]` is a no-op and the array lands wherever the compiler puts a
1-aligned local, making the parse fail with `Unaligned` depending on nothing but
stack layout. `MmbFile::parse` now states the requirement from the other side,
since it is the caller who has to satisfy it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 5c2af3e commit 42aed47
2 files changed
Lines changed: 42 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
885 | 890 | | |
886 | 891 | | |
887 | 892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
| |||
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
20 | | - | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
29 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
30 | 63 | | |
0 commit comments