Commit 045c070
## Summary
Closes the prose-readability slice of #126: reword all `#[error(...)]`
templates and replace `tw-verify`'s `{:?}` debug-dump with a grouped,
location-anchored bulleted list.
## Changes
**lib.rs — error message rewording (Display-only; no API breaks)**
Pattern: `L<n> (<aspect>): <subject is X but should be Y>`.
| Variant | Old (excerpt) | New (excerpt) |
|---|---|---|
| `LinearUsedMultiple` | "Level 10 violation: function 0, param 0 —
Linear (own) param loaded 5 times on some path" | "L10 (linearity):
function #0 parameter #0 is a Linear (own) resource but is used 5 times
on some control-flow path; Linear resources must be consumed exactly
once (possible duplication)" |
| `ExclBorrowAliased` | "Level 7 violation: function 0, param 0 —
ExclBorrow (mut) param aliased (2 simultaneous references)" | "L7
(aliasing): function #0 parameter #0 is an ExclBorrow (&mut) reference
but 2 simultaneous borrows occur on some control-flow path; at most one
is permitted" |
| `ModuleNotIsolated` | "Level 13 violation: {reason}" | "L13 (module
isolation): {reason}" |
| `LinearImportCalledMultiple` | "Level 10 boundary violation: caller fn
7 calls import 'consume' 2 time(s)…" | "L10 (linearity, cross-module):
caller function #7 calls Linear import 'consume' 2 times on some
control-flow path; Linear imports must be called at most once on every
path" |
| `MissingDependentRegions` | "Level 2 violation: typedwasm.access-sites
section emitted without companion typedwasm.regions section
(MissingDependentCarrier)" | "L2 (region binding):
typedwasm.access-sites section is present but the companion
typedwasm.regions section is missing — access-site (region, field) keys
have nothing to resolve against" |
Same treatment for `LinearNotUsed`, `LinearDroppedOnSomePath`,
`LinearImportDroppedOnSomePath`, `CapabilitiesError::*`,
`AccessSiteError::*`.
**VerifyError Vec-wrappers**: replaced raw `{:?}` debug with a
`display_first_then_ellipsis` helper that renders as `"3 L7/L10/L13
ownership violation(s) — <first error's full Display>; … and 2 more"`.
**bin/tw-verify.rs — grouped output**
Replaces the previous flat `{:?}` / `{e}` printouts with grouping:
- `OwnershipError`s are bucketed by `func_idx` (with `(module-scope)`
bucket for L13). Per bucket, errors are sorted by `param_idx` and
printed as ` - <message>`.
- `CrossError`s are bucketed by `caller_func_idx`.
- L2 / L15 errors get an explicit `FAIL <pass> ({n} violation(s))`
header + bulleted list.
Sample output (before / after) — see commit message for details.
## Out of scope
Source-line resolution ("at `.twasm` line N") **defers to #129** (source
maps). The verifier still has only wasm-level indices today; the `#0`
parameter / `#N` function notation makes that boundary explicit in the
prose.
## Test plan
- [x] `cargo test -p typed-wasm-verify` — 65 lib tests pass (62 baseline
+ 3 new Display tests)
- [x] `cargo test -p typed-wasm-verify --all-features` — 80 lib + 10
cross-compat + 5 cross-compat-real all green
- [x] `cargo clippy -p typed-wasm-verify --all-features --tests` — no
new warnings (the pre-existing `collapsible-match` at `verify.rs:323`
remains; not mine)
- [x] No test compared raw error strings (all use `matches!` on
variants), so rewording is backwards-compatible for the test suite
Refs #126. Source-line resolution defers to #129.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b45e01e commit 045c070
2 files changed
Lines changed: 191 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
57 | 64 | | |
58 | | - | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
68 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| |||
79 | 92 | | |
80 | 93 | | |
81 | 94 | | |
82 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
83 | 102 | | |
84 | 103 | | |
85 | 104 | | |
| |||
91 | 110 | | |
92 | 111 | | |
93 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
130 | | - | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | | - | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
137 | 154 | | |
138 | 155 | | |
139 | 156 | | |
| |||
167 | 184 | | |
168 | 185 | | |
169 | 186 | | |
170 | | - | |
| 187 | + | |
171 | 188 | | |
172 | 189 | | |
173 | 190 | | |
174 | 191 | | |
175 | 192 | | |
176 | 193 | | |
177 | | - | |
| 194 | + | |
178 | 195 | | |
179 | 196 | | |
180 | 197 | | |
| |||
192 | 209 | | |
193 | 210 | | |
194 | 211 | | |
195 | | - | |
| 212 | + | |
196 | 213 | | |
197 | 214 | | |
198 | | - | |
| 215 | + | |
199 | 216 | | |
200 | 217 | | |
201 | 218 | | |
202 | 219 | | |
203 | 220 | | |
204 | 221 | | |
205 | | - | |
| 222 | + | |
206 | 223 | | |
207 | 224 | | |
208 | 225 | | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
212 | | - | |
| 229 | + | |
213 | 230 | | |
214 | 231 | | |
215 | 232 | | |
| |||
387 | 404 | | |
388 | 405 | | |
389 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
390 | 466 | | |
0 commit comments