Commit 6b759a2
fix(checkpoint): file-based persistence is native-only, and now says so (#22)
`cargo check --target wasm32-unknown-unknown` fails on the **default** feature
set with a dozen "`?` couldn't convert the error to `CheckpointError`".
The cause is a gate that drifted out of step with the error type it feeds.
`CheckpointError::Io` is `#[cfg(not(target_arch = "wasm32"))]` and its doc reads
"native only", with `Storage(String)` offered as the wasm alternative -- so the
error enum already encodes that file I/O is not a wasm concern. But
`checkpoint::recovery` and `InteractiveSession::{save,load}` were gated on
`feature = "checkpoint"` alone, which is on by default and says nothing about
the target. On wasm32 the file-I/O code was therefore still compiled while the
variant its `?` operators desugar into was not.
Both are now gated on `all(feature = "checkpoint", not(target_arch = "wasm32"))`,
matching the intent the error type had already declared. Gating rather than
adding a wasm `From<io::Error>` is deliberate: `wasm32-unknown-unknown` has no
filesystem, so `File::create` there could only ever be a compile-time promise of
a runtime failure.
Not a `parallel` problem, which is worth recording because it is the natural
guess: `--features parallel --no-default-features` already checks clean on
wasm32. `checkpoint` was the only blocker, so a downstream crate that reached
for `default-features = false` to get a wasm build no longer needs to.
wasm32 now checks clean with default features -- zero errors, zero warnings.
Native untouched: 681 tests pass, fmt and clippy clean.
Claude-Session: https://claude.ai/code/session_01SHNw2k18vFYcaTukhmvbAQ
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 51dc9fa commit 6b759a2
3 files changed
Lines changed: 28 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
10 | 25 | | |
11 | 26 | | |
12 | 27 | | |
13 | 28 | | |
14 | | - | |
| 29 | + | |
15 | 30 | | |
16 | 31 | | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
21 | | - | |
| 36 | + | |
22 | 37 | | |
23 | 38 | | |
24 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
389 | 391 | | |
390 | 392 | | |
391 | 393 | | |
| |||
0 commit comments