pub enum OpClass {
OverflowFree,
NeedsWiderScratch,
Unbounded,
}Expand description
Classification of an operation’s worst-case i64 intermediate.
OverflowFree means EVERY i64 intermediate across the WHOLE op
body provably fits i64 — the smart-constructor guard (fromInt /
fromX) is STILL REQUIRED. The verdict is the join over the final
tail interval, every intermediate subexpression interval, and every
earlier binding’s interval (see classify_op): a single
out-of-i64 intermediate anywhere — even one whose value never
reaches the tail — pulls the class out of OverflowFree. It does
NOT mean “the result is in range without the guard”: the result of
e.g. IntRange.add([0,100], [0,100]) = [0,200] fits i64 but
exceeds the type’s [0,100] bound, so fromInt must still run to
re-validate the invariant. A future codegen recognizer that lowers
the arithmetic to raw i64 on the strength of this class must keep
the fromInt call. Dropping it reintroduces the model-vs-runtime
gap this whole mechanism exists to close.
Variants§
OverflowFree
The arithmetic intermediate provably fits i64, so it can run
on raw i64 without wrapping before the guard re-validates.
NeedsWiderScratch
The intermediate exceeds i64 but is a proven-finite range, so
a future codegen could compute it in a wider scratch type
(i128 or bignum) and then narrow through the guard. None of
the current example types reach this band; it exists so the
classifier is honest about the middle case rather than
collapsing it into Unbounded.
Unbounded
The intermediate has no derivable finite bound — typically
because an operand is a one-sided refinement ([0, +inf]) or a
plain Int (unbounded by construction). The honest decline:
the analysis cannot certify the operation as native-i64-safe.
Implementations§
Trait Implementations§
impl Copy for OpClass
impl Eq for OpClass
impl StructuralPartialEq for OpClass
Auto Trait Implementations§
impl Freeze for OpClass
impl RefUnwindSafe for OpClass
impl Send for OpClass
impl Sync for OpClass
impl Unpin for OpClass
impl UnsafeUnpin for OpClass
impl UnwindSafe for OpClass
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.