Commit d36e960
Remove MaybeUninit slice helpers now stabilized in std (#1606)
Removes two `MaybeUninit` slice helpers from `binius-utils` and switches
the one caller to the standard-library method. Pure refactor — no
behavior change.
### The problem
`crates/utils/src/mem.rs` carried two hand-rolled helpers, each with a
comment saying "this can be removed when
[rust-lang/rust#63569](rust-lang/rust#63569)
is stabilized":
- `slice_assume_init_mut(&mut [MaybeUninit<T>]) -> &mut [T]`
- `slice_assume_init_ref(&[MaybeUninit<T>]) -> &[T]`
That issue has since stabilized. The methods now live on the slice type
itself as `<[MaybeUninit<T>]>::assume_init_mut()` and
`assume_init_ref()`, available on stable from edition 2024 — which is
what this repo builds on (Rust 1.95.0).
### The change
One caller used `slice_assume_init_mut`, in
`crates/hash/src/binary_merkle_tree.rs`:
```diff
- slice_assume_init_mut(prev_layer)
+ prev_layer.assume_init_mut()
- slice_assume_init_mut(next_layer)
+ next_layer.assume_init_mut()
```
The two operations are identical — both reinterpret an initialized
`[MaybeUninit<T>]` as `[T]` — so the `unsafe` safety argument at each
call site is unchanged.
### Scope
- **removed:** `slice_assume_init_mut` and `slice_assume_init_ref` from
`mem.rs`. The latter had zero call sites — it was dead code.
- **kept:** `slice_uninit_mut` (`&mut [T] -> &mut [MaybeUninit<T>]`) —
std still has no stable equivalent for that direction.
- **changed:** two call sites + one import in `binary_merkle_tree.rs`.
### Verification
- `cargo check --workspace --all-targets`, `cargo clippy -p binius-utils
-p binius-hash`, nightly `cargo fmt --all` — clean
- `cargo test -p binius-hash` — 7 passed
- Confirmed the std methods compile with no `#![feature(...)]` gate
against the repo's 1.95.0 toolchain
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6867453 commit d36e960
2 files changed
Lines changed: 2 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | | - | |
| 128 | + | |
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
| |||
137 | 136 | | |
138 | 137 | | |
139 | 138 | | |
140 | | - | |
| 139 | + | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
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 | | - | |
63 | | - | |
64 | | - | |
0 commit comments