Commit defa5df
authored
Six dead-code warnings, two genuinely load-bearing fixes and four
intent-signaling cleanups. PR4 of 4 from #22.
Substantive wire-ups (the "dead" fields were forgotten implementations):
* my-ai AICache::timestamp -- the cache stored a timestamp on every set
but `get` never consulted it, so it was an unbounded-growth cache
pretending to be a TTL cache. Added a `ttl: Duration` field with a
five-minute default, made `get` honour the TTL, and made `set` sweep
expired entries before inserting. New helpers `with_ttl(Duration)`
for custom TTLs. Three new tokio tests pin the round-trip, expiry,
and on-set eviction behaviours.
* my-mir Frame::function -- captured at every `call` and never read.
The InterpreterError::StackOverflow variant grew `function`, `depth`,
and `call_chain` fields, populated from the live frame stack. A
stack overflow now reports both the call we tried to make and the
chain that led there; the previously-dead field carries that chain.
Intent-signaling cleanups (these are real stubs awaiting feature work):
* my-pkg Resolver::registry -- the field is allocated and held but the
current resolver picks placeholder versions (`// TODO: Query
registry`), so the field is genuinely unused today. Kept (rather than
dropped, to preserve the `Resolver::new(Registry)` constructor for
when the real resolver lands) with `#[allow(dead_code)]` + comment.
* my-pkg resolve / resolve_dependency / store -- three parameters
(`root_version`, `graph`, `data`) renamed to `_root_version`,
`_graph`, `_data` so the placeholder implementations stop tripping
`unused_variables` without changing call signatures. Each gets a
comment naming the `TODO` that will revive it.
Mechanical:
* my-lang Environment -- replaced the manual `Default` impl with
`#[derive(Default)]` on the struct (the impl was a verbose
reimplementation of what derive produces; both call sites of
`Environment::default()` are unchanged).
Out of scope (kept clean):
* parser.rs `parse_comptime_decl` (never used) -- overlaps with the
depth-guard PR #21 still in review; will land cleanly once #21 merges.
Tests:
* `cargo test -p my-ai --lib` -- 5/5 pass (2 pre-existing + 3 new TTL
tests).
* `cargo test -p my-mir --lib` -- 1/1 pass.
* `cargo test -p my-pkg --lib` -- 1/1 pass.
* `cargo test -p my-lang --lib interpreter::` -- 13/13 pass.
* `cargo test -p my-lang --lib library::common::` -- 39/39 pass.
1 parent 839e477 commit defa5df
4 files changed
Lines changed: 124 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
| |||
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
428 | 436 | | |
| 437 | + | |
429 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
430 | 447 | | |
431 | 448 | | |
| 449 | + | |
432 | 450 | | |
433 | 451 | | |
434 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
435 | 457 | | |
436 | 458 | | |
437 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
438 | 466 | | |
439 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
440 | 472 | | |
441 | 473 | | |
| 474 | + | |
| 475 | + | |
442 | 476 | | |
443 | 477 | | |
444 | 478 | | |
| |||
694 | 728 | | |
695 | 729 | | |
696 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
697 | 778 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | 181 | | |
190 | 182 | | |
191 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
1005 | | - | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
1006 | 1010 | | |
1007 | 1011 | | |
1008 | 1012 | | |
| |||
1089 | 1093 | | |
1090 | 1094 | | |
1091 | 1095 | | |
1092 | | - | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1093 | 1111 | | |
1094 | 1112 | | |
1095 | 1113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
147 | | - | |
148 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
| |||
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
176 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| |||
306 | 316 | | |
307 | 317 | | |
308 | 318 | | |
309 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
310 | 325 | | |
311 | 326 | | |
312 | 327 | | |
313 | 328 | | |
314 | | - | |
| 329 | + | |
315 | 330 | | |
316 | 331 | | |
317 | 332 | | |
| |||
0 commit comments