Skip to content

Conversation

@jberthold
Copy link
Member

  • assert_inhabited implementation
  • stable-mir-json upgrade
  • simplifications for bit-shifts/masks in conversions

Stevengre and others added 5 commits November 18, 2025 05:02
The
[assert_inhabited](https://doc.rust-lang.org/std/intrinsics/fn.assert_inhabited.html)
intrinsic will (possibly) panic if a type in uninhabited (cannot be
instantiated). E.g.
```rust
assert_inhabited<!>(); // panics (probably)
assert_inhabited<u8>(); // does nothing
```

Despite being an `assert`, panicking is not guaranteed and is dependent
on the target and code generation - it is sound to perform a NO OP.
Since calling the intrinsic comes from a `TerminatorKind::Call`, there
must be a `BasicBlock` to go to after the call. However we observe that
for `assert_inhabited<!>()` the execution continues to `noBasicBlockIdx`
(which would get stuck). The semantics looks for this case and converts
to `#AssertInhabitedFailure`, and otherwise performs a `NO OP`.
* declares that `#intAsType` and `littleEndianFromBytes` equations
preserve definedness (booster should apply them)
* removes round-trips from (symbolic) `discriminant` to `variantIdx` and
back
* simplifies repeated bit shifts and asserts magnitude limit for
byte-sliced values
Conflicts:
  kmir/src/kmir/kdist/mir-semantics/lemmas/kmir-lemmas.md
  (previous squash-merge of mapOffset simplification)
@jberthold jberthold requested review from Stevengre, dkcumming and tothtamas28 and removed request for tothtamas28 November 19, 2025 05:24
@jberthold jberthold marked this pull request as ready for review November 19, 2025 05:24
@jberthold jberthold merged commit a6dc6f1 into feature/p-token Nov 19, 2025
14 checks passed
@jberthold jberthold deleted the update-from-master branch November 19, 2025 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants