Commit bbee7f9
feat(rt): support transmuting pointer to integer type
Add a `#cast` rule for `castKindTransmute` that handles `PtrLocal` to
integer type conversion. The rule extracts the pointer offset from
metadata and converts it to the target integer type via `#intAsType`.
A helper function `#ptrOffsetBytes` computes byte offsets from pointer
offsets, accounting for array element sizes when the pointee is an
unsized array type.
This fixes the `interior-mut3` test which uses `UnsafeCell::get()`
(internally transmutes a pointer to `usize` for alignment checks).
The proof now passes cleanly in 333 steps instead of getting stuck
on unresolved alignment assertions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b694d02 commit bbee7f9
5 files changed
Lines changed: 57 additions & 64 deletions
File tree
- kmir/src
- kmir/kdist/mir-semantics/rt
- tests/integration
- data/prove-rs
- show
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1624 | 1624 | | |
1625 | 1625 | | |
1626 | 1626 | | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1627 | 1666 | | |
1628 | 1667 | | |
1629 | 1668 | | |
| |||
Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
0 commit comments