From 4fb9a32a171d4b0f7e146cfb10d57ca1cdd56172 Mon Sep 17 00:00:00 2001 From: Daniel Cumming <124537596+dkcumming@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:28:43 +1000 Subject: [PATCH 1/2] Initial Ptr Offset semantics `binOpOffset` (#746) Support for `binOpOffset` - `binOpOffset` is applied to a `PtrLocal` but must come from a `Range` of some kind (e.g. `[u8; 2]`, `&[u8]`) in which case the offset is applied to a pointer to the element e.g. `*const u8`; - Both `Reference` and `PtrLocal` has the same `Metadata` that tracks and offset; - In order to ensure that pointers are not out of range when the offset is applied, `Metadata` has an `OriginSize` field for `PtrLocal` and `Reference` for the necessary bounds checking in the external `Range`; - After an offset is applied to a `PtrLocal` it can be turned back into a `Reference`, which essentially is an index into the `Range` but it does not return the element type but the `Range` type (with smaller bounds); - The bulk of the change is in `#traverseProjection` that now needs to account for an offset when a `projectionDeref` occurs; - When a non-zero offset is encountered a `ProjectionElem::PointerOffset` is appended to the place projections, later this will be turned into a `CtxPointerOffset` when the contexts are being processed; - `CtxPointerOffset` is essentially the same as a subslice as we must have a `Range` to be offsetting through Test cases for read and write are added --------- Co-authored-by: Jost Berthold --- kmir/src/kmir/decoding.py | 4 +- kmir/src/kmir/kast.py | 36 +- kmir/src/kmir/kdist/mir-semantics/rt/data.md | 334 +++++++++++++----- .../kmir/kdist/mir-semantics/rt/decoding.md | 4 +- kmir/src/kmir/kdist/mir-semantics/rt/types.md | 26 +- kmir/src/kmir/kdist/mir-semantics/rt/value.md | 27 +- kmir/src/kmir/value.py | 19 +- .../allocs/array_const_compare.state | 8 +- .../exec-smir/allocs/array_nest_compare.state | 8 +- .../exec-smir/allocs/enum-two-refs-fail.state | 2 +- .../data/exec-smir/arrays/array_inlined.state | 8 +- .../data/exec-smir/arrays/array_write.state | 2 +- .../data/exec-smir/intrinsic/blackbox.state | 8 +- .../exec-smir/intrinsic/raw_eq_simple.state | 4 +- .../exec-smir/niche-enum/niche-enum.state | 24 +- .../pointer-cast-length-test-fail.state | 14 +- .../exec-smir/references/array_elem_ref.state | 4 +- .../data/exec-smir/references/doubleRef.state | 10 +- .../exec-smir/references/mutableRef.state | 4 +- .../data/exec-smir/references/refAsArg.state | 2 +- .../data/exec-smir/references/refAsArg2.state | 2 +- .../exec-smir/references/refReturned.state | 4 +- .../data/exec-smir/references/simple.state | 2 +- .../data/exec-smir/references/weirdRefs.state | 24 +- .../integration/data/prove-rs/offset_read.rs | 5 + .../data/prove-rs/offset_struct_field_read.rs | 9 + .../prove-rs/offset_struct_field_write.rs | 10 + .../integration/data/prove-rs/offset_write.rs | 6 + .../data/prove-rs/slice-split-at.rs | 27 ++ .../simple-types/final-1.expected | 8 +- .../simple-types/final-4.expected | 8 +- .../simple-types/final-7.expected | 8 +- .../simple-types/final-9.expected | 8 +- 33 files changed, 460 insertions(+), 209 deletions(-) create mode 100644 kmir/src/tests/integration/data/prove-rs/offset_read.rs create mode 100644 kmir/src/tests/integration/data/prove-rs/offset_struct_field_read.rs create mode 100644 kmir/src/tests/integration/data/prove-rs/offset_struct_field_write.rs create mode 100644 kmir/src/tests/integration/data/prove-rs/offset_write.rs create mode 100644 kmir/src/tests/integration/data/prove-rs/slice-split-at.rs diff --git a/kmir/src/kmir/decoding.py b/kmir/src/kmir/decoding.py index 98e77b6ea..e5b114de6 100644 --- a/kmir/src/kmir/decoding.py +++ b/kmir/src/kmir/decoding.py @@ -43,7 +43,7 @@ from pyk.kast import KInner from .ty import FieldsShape, IntegerLength, LayoutShape, MachineSize, Scalar, TagEncoding, Ty, TypeMetadata, UintTy - from .value import Metadata + from .value import MetadataSize @dataclass @@ -145,7 +145,7 @@ def _pointee_ty(type_info: TypeMetadata) -> Ty | None: return None -def _metadata(type_info: TypeMetadata) -> Metadata: +def _metadata(type_info: TypeMetadata) -> MetadataSize: match type_info: case ArrayT(length=None): return DynamicSize(1) # 1 is a placeholder, the actual size is inferred from the slice data diff --git a/kmir/src/kmir/kast.py b/kmir/src/kmir/kast.py index 7a31b8845..95adbbedb 100644 --- a/kmir/src/kmir/kast.py +++ b/kmir/src/kmir/kast.py @@ -23,7 +23,7 @@ from .smir import SMIRInfo from .ty import TypeMetadata - from .value import Metadata, Value + from .value import MetadataSize, Value _LOGGER: Final = logging.getLogger(__name__) @@ -312,6 +312,14 @@ def _fresh_var(self, prefix: str) -> KVariable: def _symbolic_value(self, ty: Ty, mutable: bool) -> tuple[KInner, Iterable[KInner], KInner | None]: # returns: symbolic value of given type, related constraints, related pointer metadata + + no_metadata = KApply( + 'Metadata', + KApply('noMetadataSize', ()), + token(0), + KApply('noMetadataSize', ()), + ) + match self.types.get(ty): case IntT(info): val, constraints = int_var(self._fresh_var('ARG_INT'), info.value, True) @@ -359,7 +367,14 @@ def _symbolic_value(self, ty: Ty, mutable: bool) -> tuple[KInner, Iterable[KInne return ( KApply('Value::Range', (elems,)), [mlEqualsTrue(eqInt(KApply('sizeList', (elems,)), l))], - KApply('dynamicSize', (l,)), + KApply( + 'Metadata', + ( + KApply('dynamicSize', (l,)), + token(0), + KApply('dynamicSize', (l,)), + ), + ), ) case ArrayT(element_type, size) if size is not None: @@ -372,7 +387,14 @@ def _symbolic_value(self, ty: Ty, mutable: bool) -> tuple[KInner, Iterable[KInne return ( KApply('Value::Range', (list_of(elem_vars),)), elem_constraints, - KApply('staticSize', (token(size),)), + KApply( + 'Metadata', + ( + KApply('staticSize', (token(size),)), + token(0), + KApply('staticSize', (token(size),)), + ), + ), ) case TupleT(components): @@ -397,10 +419,10 @@ def _symbolic_value(self, ty: Ty, mutable: bool) -> tuple[KInner, Iterable[KInne KApply( 'Value::Reference', ( - token(0), + token(0), # Stack OFFSET field KApply('place', (KApply('local', (token(ref),)), KApply('ProjectionElems::empty', ()))), KApply('Mutability::Mut', ()) if mutable else KApply('Mutability::Not', ()), - metadata if metadata is not None else KApply('noMetadata', ()), + metadata if metadata is not None else no_metadata, ), ), pointee_constraints, @@ -418,7 +440,7 @@ def _symbolic_value(self, ty: Ty, mutable: bool) -> tuple[KInner, Iterable[KInne token(0), KApply('place', (KApply('local', (token(ref),)), KApply('ProjectionElems::empty', ()))), KApply('Mutability::Mut', ()) if mutable else KApply('Mutability::Not', ()), - KApply('PtrEmulation', (metadata if metadata is not None else KApply('noMetadata', ()),)), + metadata if metadata is not None else no_metadata, ), ), pointee_constraints, @@ -479,7 +501,7 @@ class SimpleRes(NamedTuple): class ArrayRes(NamedTuple): value: TypedValue - metadata: Metadata + metadata: MetadataSize class PointerRes(NamedTuple): diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/data.md b/kmir/src/kmir/kdist/mir-semantics/rt/data.md index 27a5857aa..5656f4a63 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/data.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/data.md @@ -306,6 +306,9 @@ These helpers mark down, as we traverse the projection, what `Place` we are curr syntax Context ::= CtxField( VariantIdx, List, Int , Ty ) | CtxIndex( List , Int ) // array index constant or has been read before | CtxSubslice( List , Int , Int ) // start and end always counted from beginning + | CtxPointerOffset( List, Int, Int ) // pointer offset for accessing elements with an offset (Offset, Origin Length) + + syntax ProjectionElem ::= PointerOffset( Int, Int ) // Same as subslice but coming from BinopOffset injected by us syntax Contexts ::= List{Context, ""} @@ -328,6 +331,12 @@ These helpers mark down, as we traverse the projection, what `Place` we are curr requires size(INNER) ==Int END -Int START // ensures updateList is defined [preserves-definedness] // START,END indexes checked before, length check for update here + // Update PointerOffset + rule #buildUpdate(Range(INNER), CtxPointerOffset(ELEMS, START, END) CTXS) + => #buildUpdate( Range(updateList(ELEMS, START, INNER)), CTXS) + requires size(INNER) ==Int END -Int START // ensures updateList is defined + [preserves-definedness] // START,END indexes checked before, length check for update here + syntax StackFrame ::= #updateStackLocal ( StackFrame, Int, Value ) [function] rule #updateStackLocal(StackFrame(CALLER, DEST, TARGET, UNWIND, LOCALS), I, VAL) @@ -353,8 +362,8 @@ These helpers mark down, as we traverse the projection, what `Place` we are curr // -------------------------------------------------------- rule #adjustRef(Reference(HEIGHT, PLACE, REFMUT, META), OFFSET) => Reference(HEIGHT +Int OFFSET, PLACE, REFMUT, META) - rule #adjustRef(PtrLocal(HEIGHT, PLACE, REFMUT, EMULATION), OFFSET) - => PtrLocal(HEIGHT +Int OFFSET, PLACE, REFMUT, EMULATION) + rule #adjustRef(PtrLocal(HEIGHT, PLACE, REFMUT, META), OFFSET) + => PtrLocal(HEIGHT +Int OFFSET, PLACE, REFMUT, META) rule #adjustRef(Aggregate(IDX, ARGS), OFFSET) => Aggregate(IDX, #mapOffset(ARGS, OFFSET)) rule #adjustRef(Range(ELEMS), OFFSET) @@ -375,6 +384,12 @@ These helpers mark down, as we traverse the projection, what `Place` we are curr // -------------------------------------------------------- rule #incrementRef(TL) => #adjustRef(TL, 1) rule #decrementRef(TL) => #adjustRef(TL, -1) + + syntax Int ::= originSize ( MetadataSize ) [function, total] + // --------------------------------------------------------------------- + rule originSize(noMetadataSize) => 0 // TODO: Is this fair, noMetadataSize does not really mean zero + rule originSize(staticSize(SIZE)) => SIZE + rule originSize(dynamicSize(SIZE)) => SIZE ``` #### Aggregates @@ -404,7 +419,7 @@ This is done without consideration of the validity of the Downcast[^downcast]. requires 0 <=Int I andBool I #traverseProjection( DEST, @@ -562,6 +577,23 @@ Similar to `ConstantIndex`, the slice _end_ index may count from the _end_ or t andBool 0 <=Int END andBool END #traverseProjection( + DEST, + Range(ELEMENTS), + PointerOffset(OFFSET, _ORIGIN_LENGTH) PROJS, // TODO: seems strange to not use the ORIGIN_LENGTH... + CTXTS + ) + => #traverseProjection( + DEST, + Range(range(ELEMENTS, OFFSET, 0)), + PROJS, + CtxPointerOffset(ELEMENTS, OFFSET, size(ELEMENTS)) CTXTS + ) + ... + + requires 0 <=Int OFFSET andBool OFFSET <=Int size(ELEMENTS) + [preserves-definedness] // Offset checked to be in range for ELEMENTS ``` #### References @@ -579,10 +611,10 @@ An attempt to read more elements than the length of the accessed array is undefi ```k // helper rewrite to implement truncating slices to required size - syntax KItem ::= #derefTruncate ( Metadata , ProjectionElems ) + syntax KItem ::= #derefTruncate ( MetadataSize , ProjectionElems ) // ---------------------------------------------------------------------------------------- // no metadata, no change to the value - rule #traverseProjection( DEST, VAL, .ProjectionElems, CTXTS) ~> #derefTruncate(noMetadata, PROJS) + rule #traverseProjection( DEST, VAL, .ProjectionElems, CTXTS) ~> #derefTruncate(noMetadataSize, PROJS) => #traverseProjection(DEST, VAL, PROJS, CTXTS) ... @@ -599,85 +631,184 @@ An attempt to read more elements than the length of the accessed array is undefi requires 0 <=Int SIZE andBool SIZE <=Int size(ELEMS) [preserves-definedness] // range parameters checked + // Ref, 0 < OFFSET, 0 < PTR_OFFSET, ToStack rule #traverseProjection( _DEST, - Reference(OFFSET, place(LOCAL, PLACEPROJ), _MUT, META), + Reference(OFFSET, place(LOCAL, PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, ORIGIN_SIZE)), projectionElemDeref PROJS, _CTXTS ) => #traverseProjection( toStack(OFFSET, LOCAL), #localFromFrame({STACK[OFFSET -Int 1]}:>StackFrame, LOCAL, OFFSET), - PLACEPROJ, // apply reference projections - .Contexts // previous contexts obsolete + appendP(PLACEPROJ, PointerOffset(PTR_OFFSET, originSize(ORIGIN_SIZE))), // apply reference projections with pointer offset + .Contexts ) - ~> #derefTruncate(META, PROJS) // then truncate, then continue with remaining projections + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections ... STACK requires 0 #traverseProjection( _DEST, - Reference(OFFSET, place(local(I), PLACEPROJ), _MUT, META), + Reference(OFFSET, place(LOCAL, PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, _ORIGIN_SIZE)), + projectionElemDeref PROJS, + _CTXTS + ) + => #traverseProjection( + toStack(OFFSET, LOCAL), + #localFromFrame({STACK[OFFSET -Int 1]}:>StackFrame, LOCAL, OFFSET), + PLACEPROJ, // apply reference projections with pointer offset + .Contexts + ) + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections + ... + + STACK + requires 0 #traverseProjection( + _DEST, + Reference(OFFSET, place(local(I), PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, ORIGIN_SIZE)), projectionElemDeref PROJS, _CTXTS ) => #traverseProjection( toLocal(I), getValue(LOCALS, I), - PLACEPROJ, // apply reference projections - .Contexts // previous contexts obsolete + appendP(PLACEPROJ, PointerOffset(PTR_OFFSET, originSize(ORIGIN_SIZE))), // apply reference projections with pointer offset + .Contexts ) - ~> #derefTruncate(META, PROJS) // then truncate, then continue with remaining projections + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections ... LOCALS requires OFFSET ==Int 0 andBool 0 <=Int I andBool I #traverseProjection( _DEST, - PtrLocal(OFFSET, place(LOCAL, PLACEPROJ), _MUT, ptrEmulation(META)), + Reference(OFFSET, place(local(I), PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, _ORIGIN_SIZE)), + projectionElemDeref PROJS, + _CTXTS + ) + => #traverseProjection( + toLocal(I), + getValue(LOCALS, I), + PLACEPROJ, + .Contexts + ) + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections + ... + + LOCALS + requires OFFSET ==Int 0 + andBool 0 <=Int I andBool I #traverseProjection( + _DEST, + PtrLocal(OFFSET, place(LOCAL, PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, ORIGIN_SIZE)), projectionElemDeref PROJS, _CTXTS ) => #traverseProjection( toStack(OFFSET, LOCAL), #localFromFrame({STACK[OFFSET -Int 1]}:>StackFrame, LOCAL, OFFSET), - PLACEPROJ, // apply reference projections + appendP(PLACEPROJ, PointerOffset(PTR_OFFSET, originSize(ORIGIN_SIZE))), // apply reference projections with pointer offset .Contexts // previous contexts obsolete ) - ~> #derefTruncate(META, PROJS) // then truncate, then continue with remaining projections + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections ... STACK requires 0 #traverseProjection( + _DEST, + PtrLocal(OFFSET, place(LOCAL, PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, _ORIGIN_SIZE)), + projectionElemDeref PROJS, + _CTXTS + ) + => #traverseProjection( + toStack(OFFSET, LOCAL), + #localFromFrame({STACK[OFFSET -Int 1]}:>StackFrame, LOCAL, OFFSET), + PLACEPROJ, // apply reference projections + .Contexts // add pointer offset context + ) + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections + ... + + STACK + requires 0 #traverseProjection( _DEST, - PtrLocal(OFFSET, place(local(I), PLACEPROJ), _MUT, ptrEmulation(META)), + PtrLocal(OFFSET, place(local(I), PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, ORIGIN_SIZE)), projectionElemDeref PROJS, _CTXTS ) => #traverseProjection( toLocal(I), getValue(LOCALS, I), - PLACEPROJ, // apply reference projections + appendP(PLACEPROJ, PointerOffset(PTR_OFFSET, originSize(ORIGIN_SIZE))), // apply reference projections with pointer offset .Contexts // previous contexts obsolete ) - ~> #derefTruncate(META, PROJS) // then truncate, then continue with remaining projections + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections + ... + + LOCALS + requires OFFSET ==Int 0 + andBool 0 <=Int I andBool I #traverseProjection( + _DEST, + PtrLocal(OFFSET, place(local(I), PLACEPROJ), _MUT, metadata(SIZE, PTR_OFFSET, _ORIGIN_SIZE)), + projectionElemDeref PROJS, + _CTXTS + ) + => #traverseProjection( + toLocal(I), + getValue(LOCALS, I), + PLACEPROJ, // apply reference projections + .Contexts // add pointer offset context + ) + ~> #derefTruncate(SIZE, PROJS) // then truncate, then continue with remaining projections ... LOCALS requires OFFSET ==Int 0 andBool 0 <=Int I andBool I #traverseProjection( _DEST, - AllocRef(ALLOC_ID, ALLOC_PROJS, META), + AllocRef(ALLOC_ID, ALLOC_PROJS, metadata(METADATA_SIZE, _PTR_OFFSET, _)), // FIXME can this be offset? projectionElemDeref PROJS, _CTXTS ) @@ -698,7 +829,7 @@ even though this could be supported. ALLOC_PROJS, // alloc projections .Contexts // previous contexts obsolete ) - ~> #derefTruncate(META, PROJS) // then truncate, then continue with remaining projections + ~> #derefTruncate(METADATA_SIZE, PROJS) // then truncate, then continue with remaining projections ... requires isValue(lookupAlloc(ALLOC_ID)) @@ -855,13 +986,13 @@ for _fat_ pointers it is a `usize` value indicating the data length. [^rawPtrAgg]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.AggregateKind.html#variant.RawPtr ```k - rule ListItem(PtrLocal(OFFSET, PLACE, _, _)) ListItem(Integer(LENGTH, 64, false)) ~> #mkAggregate(aggregateKindRawPtr(_TY, MUT)) - => PtrLocal(OFFSET, PLACE, MUT, ptrEmulation(dynamicSize(LENGTH))) + rule ListItem(PtrLocal(OFFSET, PLACE, _, metadata(_SIZE, PTR_OFFSET, ORIGIN_SIZE))) ListItem(Integer(LENGTH, 64, false)) ~> #mkAggregate(aggregateKindRawPtr(_TY, MUT)) + => PtrLocal(OFFSET, PLACE, MUT, metadata(dynamicSize(LENGTH), PTR_OFFSET, ORIGIN_SIZE)) ... - rule ListItem(PtrLocal(OFFSET, PLACE, _, _)) ListItem(Aggregate(_, .List)) ~> #mkAggregate(aggregateKindRawPtr(_TY, MUT)) - => PtrLocal(OFFSET, PLACE, MUT, ptrEmulation(noMetadata)) + rule ListItem(PtrLocal(OFFSET, PLACE, _, metadata(_SIZE, PTR_OFFSET, ORIGIN_SIZE))) ListItem(Aggregate(_, .List)) ~> #mkAggregate(aggregateKindRawPtr(_TY, MUT)) + => PtrLocal(OFFSET, PLACE, MUT, metadata(noMetadataSize, PTR_OFFSET, ORIGIN_SIZE)) ... ``` @@ -932,35 +1063,42 @@ This eliminates any `Deref` projections from the place, and also resolves `Index rule #projectionsFor(CtxField(_, _, I, TY) CTXS, PROJS) => #projectionsFor(CTXS, projectionElemField(fieldIdx(I), TY) PROJS) rule #projectionsFor( CtxIndex(_, I) CTXS, PROJS) => #projectionsFor(CTXS, projectionElemConstantIndex(I, 0, false) PROJS) rule #projectionsFor( CtxSubslice(_, I, J) CTXS, PROJS) => #projectionsFor(CTXS, projectionElemSubslice(I, J, false) PROJS) + // rule #projectionsFor(CtxPointerOffset(OFFSET, ORIGIN_LENGTH) CTXS, PROJS) => #projectionsFor(CTXS, projectionElemSubslice(OFFSET, ORIGIN_LENGTH, false) PROJS) + rule #projectionsFor(CtxPointerOffset( _, OFFSET, ORIGIN_LENGTH) CTXS, PROJS) => #projectionsFor(CTXS, PointerOffset(OFFSET, ORIGIN_LENGTH) PROJS) rule rvalueRef(_REGION, KIND, place(local(I), PROJS)) => #traverseProjection(toLocal(I), getValue(LOCALS, I), PROJS, .Contexts) - ~> #forRef(#mutabilityOf(KIND), #metadata(tyOfLocal({LOCALS[I]}:>TypedLocal), PROJS)) + ~> #forRef(#mutabilityOf(KIND), metadata(#metadataSize(tyOfLocal({LOCALS[I]}:>TypedLocal), PROJS), 0, noMetadataSize)) // TODO: Sus on this rule ... LOCALS requires 0 <=Int I andBool I #traverseProjection(DEST, VAL:Value, .ProjectionElems, CTXTS) ~> #forRef(MUT, META) - => #mkRef(DEST, #projectionsFor(CTXTS), MUT, #maybeDynamicSize(META, VAL)) + rule #traverseProjection(DEST, VAL:Value, .ProjectionElems, CTXTS) ~> #forRef(MUT, metadata(SIZE, OFFSET, ORIGIN_SIZE)) + => #mkRef(DEST, #projectionsFor(CTXTS), MUT, metadata(#maybeDynamicSize(SIZE, VAL), OFFSET, ORIGIN_SIZE) ) ... syntax Evaluation ::= #mkRef( WriteTo , ProjectionElems , Mutability , Metadata ) // [function, total] // ----------------------------------------------------------------------------------------------- + // Create Reference for local variable (stack depth 0, no offset) rule #mkRef( toLocal(I) , PROJS, MUT, META) => Reference( 0 , place(local(I), PROJS), MUT, META) ... + + // Create Reference for stack frame variable (stack depth OFFSET, with pointer offset) rule #mkRef(toStack(OFFSET, LOCAL), PROJS, MUT, META) => Reference(OFFSET, place( LOCAL , PROJS), MUT, META) ... + + // Create AllocRef for heap allocation (assumed zero offset, no offset concept for heap) rule #mkRef(toAlloc(ALLOC_ID) , PROJS, _ , META) => AllocRef(ALLOC_ID, PROJS, META) ... - syntax Metadata ::= #maybeDynamicSize ( Metadata , Value ) [function, total] - // ------------------------------------------------------------------------- + syntax MetadataSize ::= #maybeDynamicSize ( MetadataSize , Value ) [function, total] + // --------------------------------------------------------------------------------- rule #maybeDynamicSize(dynamicSize(_), Range(LIST)) => dynamicSize(size(LIST)) - rule #maybeDynamicSize(dynamicSize(_), _OTHER ) => noMetadata [priority(100)] + rule #maybeDynamicSize(dynamicSize(_), _OTHER ) => noMetadataSize [priority(100)] rule #maybeDynamicSize( OTHER_META , _ ) => OTHER_META [owise] syntax Mutability ::= #mutabilityOf ( BorrowKind ) [function, total] @@ -989,25 +1127,25 @@ The operation typically creates a pointer with empty metadata. rule rvalueAddressOf(MUT, place(local(I), PROJS)) => #traverseProjection(toLocal(I), getValue(LOCALS, I), PROJS, .Contexts) - ~> #forPtr(MUT, #metadata(tyOfLocal({LOCALS[I]}:>TypedLocal), PROJS)) + ~> #forPtr(MUT, metadata(#metadataSize(tyOfLocal({LOCALS[I]}:>TypedLocal), PROJS), 0, noMetadataSize)) // TODO These initial values might get overwrote // we should use #alignOf to emulate the address ... LOCALS requires 0 <=Int I andBool I #traverseProjection(DEST, VAL:Value, .ProjectionElems, CTXTS) ~> #forPtr(MUT, META) - => #mkPtr(DEST, #projectionsFor(CTXTS), MUT, #maybeDynamicSize(META, VAL)) + rule #traverseProjection(DEST, VAL:Value, .ProjectionElems, CTXTS) ~> #forPtr(MUT, metadata(SIZE, OFFSET, ORIGIN_SIZE)) + => #mkPtr(DEST, #projectionsFor(CTXTS), MUT, metadata(#maybeDynamicSize(SIZE, VAL), OFFSET, ORIGIN_SIZE)) ... syntax Evaluation ::= #mkPtr ( WriteTo, ProjectionElems, Mutability , Metadata ) // [function, total] // ------------------------------------------------------------------------------------------ - rule #mkPtr( toLocal(I) , PROJS, MUT, META) => PtrLocal( 0 , place(local(I), PROJS), MUT, ptrEmulation(META)) ... - rule #mkPtr(toStack(OFFSET, LOCAL), PROJS, MUT, META) => PtrLocal(OFFSET, place( LOCAL , PROJS), MUT, ptrEmulation(META)) ... + rule #mkPtr( toLocal(I) , PROJS, MUT, META) => PtrLocal( 0 , place(local(I), PROJS), MUT, META) ... + rule #mkPtr(toStack(STACK_OFFSET, LOCAL), PROJS, MUT, META) => PtrLocal(STACK_OFFSET, place( LOCAL , PROJS), MUT, META) ... ``` In practice, the `AddressOf` can often be found applied to references that get dereferenced first, @@ -1035,7 +1173,7 @@ a special rule for this case is applied with higher priority. syntax Value ::= refToPtrLocal ( Value , Mutability ) [function] - rule refToPtrLocal(Reference(OFFSET, PLACE, _, META), MUT) => PtrLocal(OFFSET, PLACE, MUT, ptrEmulation(META)) + rule refToPtrLocal(Reference(STACK_OFFSET, PLACE, _, META), MUT) => PtrLocal(STACK_OFFSET, PLACE, MUT, META) ``` ## Type casts @@ -1111,24 +1249,24 @@ Conversion is especially possible for the case of _Slices_ (of dynamic length) a which have the same representation `Value::Range`. ```k - rule #cast(PtrLocal(OFFSET, PLACE, MUT, EMUL), castKindPtrToPtr, TY_SOURCE, TY_TARGET) + rule #cast(PtrLocal(OFFSET, PLACE, MUT, META), castKindPtrToPtr, TY_SOURCE, TY_TARGET) => - PtrLocal(OFFSET, PLACE, MUT, #convertPtrEmul(EMUL, lookupTy(TY_TARGET))) + PtrLocal(OFFSET, PLACE, MUT, #convertMetadata(META, lookupTy(TY_TARGET))) ... requires #typesCompatible(lookupTy(TY_SOURCE), lookupTy(TY_TARGET)) [preserves-definedness] // valid map lookups checked - syntax PtrEmulation ::= #convertPtrEmul ( PtrEmulation , TypeInfo ) [function, total] - // ---------------------------------------------------------------------------------- + syntax Metadata ::= #convertMetadata ( Metadata , TypeInfo ) [function, total] + // ------------------------------------------------------------------------------------- ``` Pointers to slices can be converted to pointers to single elements, _losing_ their metadata. ```k - rule #convertPtrEmul( ptrEmulation(_) , typeInfoRefType(POINTEE_TY)) => ptrEmulation(noMetadata) - requires #metadata(POINTEE_TY) ==K noMetadata [priority(60)] - rule #convertPtrEmul( ptrEmulation(_) , typeInfoPtrType(POINTEE_TY)) => ptrEmulation(noMetadata) - requires #metadata(POINTEE_TY) ==K noMetadata [priority(60)] + rule #convertMetadata( metadata(SIZE, OFFSET, _) , typeInfoRefType(POINTEE_TY) ) => metadata(noMetadataSize, OFFSET, SIZE) + requires #metadataSize(POINTEE_TY) ==K noMetadataSize [priority(60)] + rule #convertMetadata( metadata(SIZE, OFFSET, _) , typeInfoPtrType(POINTEE_TY) ) => metadata(noMetadataSize, OFFSET, SIZE) + requires #metadataSize(POINTEE_TY) ==K noMetadataSize [priority(60)] ``` Conversely, when casting a pointer to an element to a pointer to a slice or array, @@ -1138,17 +1276,17 @@ the original allocation size must be checked to be sufficient. ```k // no metadata to begin with, fill it in from target type (NB dynamicSize(1) if dynamic) - rule #convertPtrEmul( ptrEmulation(noMetadata) , typeInfoRefType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) - rule #convertPtrEmul( ptrEmulation(noMetadata) , typeInfoPtrType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) + rule #convertMetadata( metadata(noMetadataSize, OFFSET, _) , typeInfoRefType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, noMetadataSize) + rule #convertMetadata( metadata(noMetadataSize, OFFSET, _) , typeInfoPtrType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, noMetadataSize) ``` Conversion from an array to a slice pointer requires adding metadata (`dynamicSize`) with the previously-static length. ```k // convert static length to dynamic length - rule #convertPtrEmul(ptrEmulation(staticSize(SIZE)), typeInfoRefType(POINTEE_TY)) => ptrEmulation(dynamicSize(SIZE)) - requires #metadata(POINTEE_TY) ==K dynamicSize(1) - rule #convertPtrEmul(ptrEmulation(staticSize(SIZE)), typeInfoPtrType(POINTEE_TY)) => ptrEmulation(dynamicSize(SIZE)) - requires #metadata(POINTEE_TY) ==K dynamicSize(1) + rule #convertMetadata(metadata(staticSize(SIZE), OFFSET, _), typeInfoRefType(POINTEE_TY)) => metadata(dynamicSize(SIZE), OFFSET, staticSize(SIZE)) + requires #metadataSize(POINTEE_TY) ==K dynamicSize(1) + rule #convertMetadata(metadata(staticSize(SIZE), OFFSET, _), typeInfoPtrType(POINTEE_TY)) => metadata(dynamicSize(SIZE), OFFSET, staticSize(SIZE)) + requires #metadataSize(POINTEE_TY) ==K dynamicSize(1) ``` Conversion from a slice to an array pointer, or between different static length array pointers, is allowed in all cases. @@ -1157,29 +1295,29 @@ It may however be illegal to _dereference_ (i.e., access) the created pointer, d **TODO** we can mark cases of insufficient original length as "InvalidCast" in the future, similar to the above future work. ```k - rule #convertPtrEmul(ptrEmulation(staticSize(_)), typeInfoRefType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) - requires #metadata(POINTEE_TY) =/=K dynamicSize(1) - rule #convertPtrEmul(ptrEmulation(staticSize(_)), typeInfoPtrType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) - requires #metadata(POINTEE_TY) =/=K dynamicSize(1) - - rule #convertPtrEmul(ptrEmulation(dynamicSize(_)), typeInfoRefType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) - requires #metadata(POINTEE_TY) =/=K dynamicSize(1) - rule #convertPtrEmul(ptrEmulation(dynamicSize(_)), typeInfoPtrType(POINTEE_TY)) => ptrEmulation(#metadata(POINTEE_TY)) - requires #metadata(POINTEE_TY) =/=K dynamicSize(1) + rule #convertMetadata(metadata(staticSize(_) #as ORIGIN_SIZE, OFFSET, _), typeInfoRefType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, ORIGIN_SIZE) + requires #metadataSize(POINTEE_TY) =/=K dynamicSize(1) + rule #convertMetadata(metadata(staticSize(_) #as ORIGIN_SIZE, OFFSET, _), typeInfoPtrType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, ORIGIN_SIZE) + requires #metadataSize(POINTEE_TY) =/=K dynamicSize(1) + + rule #convertMetadata(metadata(dynamicSize(_) #as ORIGIN_SIZE, OFFSET, _), typeInfoRefType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, ORIGIN_SIZE) + requires #metadataSize(POINTEE_TY) =/=K dynamicSize(1) + rule #convertMetadata(metadata(dynamicSize(_) #as ORIGIN_SIZE, OFFSET, _), typeInfoPtrType(POINTEE_TY)) => metadata(#metadataSize(POINTEE_TY), OFFSET, ORIGIN_SIZE) + requires #metadataSize(POINTEE_TY) =/=K dynamicSize(1) ``` For a cast bwetween two pointer types with `dynamicSize` metadata (unlikely to occur), the dynamic size value is retained. ```k - rule #convertPtrEmul(ptrEmulation(dynamicSize(SIZE)), typeInfoRefType(POINTEE_TY)) => ptrEmulation(dynamicSize(SIZE)) - requires #metadata(POINTEE_TY) ==K dynamicSize(1) - rule #convertPtrEmul(ptrEmulation(dynamicSize(SIZE)), typeInfoPtrType(POINTEE_TY)) => ptrEmulation(dynamicSize(SIZE)) - requires #metadata(POINTEE_TY) ==K dynamicSize(1) + rule #convertMetadata(metadata(dynamicSize(SIZE), OFFSET, _), typeInfoRefType(POINTEE_TY)) => metadata(dynamicSize(SIZE), OFFSET, dynamicSize(SIZE)) + requires #metadataSize(POINTEE_TY) ==K dynamicSize(1) + rule #convertMetadata(metadata(dynamicSize(SIZE), OFFSET, _), typeInfoPtrType(POINTEE_TY)) => metadata(dynamicSize(SIZE), OFFSET, dynamicSize(SIZE)) + requires #metadataSize(POINTEE_TY) ==K dynamicSize(1) ``` ```k // non-pointer and non-ref target type (should not happen!) - rule #convertPtrEmul( _ , _OTHER_INFO ) => ptrEmulation(noMetadata) [priority(100)] + rule #convertMetadata( metadata(SIZE, OFFSET, _) , _OTHER_INFO ) => metadata(noMetadataSize, OFFSET, SIZE) [priority(100)] ``` `PointerCoercion` may achieve a simmilar effect, or deal with function and closure pointers, depending on the coercion type: @@ -1200,9 +1338,9 @@ Specifically, pointers to arrays of statically-known length are cast to pointers The original metadata is therefore already stored as `staticSize` to avoid having to look it up here. ```k - rule #cast(Reference(OFFSET, PLACE, MUT, staticSize(SIZE)), castKindPointerCoercion(pointerCoercionUnsize), _TY_SOURCE, _TY_TARGET) + rule #cast(Reference(OFFSET, PLACE, MUT, metadata(staticSize(SIZE), PTR_OFFSET, ORIGIN_SIZE)), castKindPointerCoercion(pointerCoercionUnsize), _TY_SOURCE, _TY_TARGET) => - Reference(OFFSET, PLACE, MUT, dynamicSize(SIZE)) + Reference(OFFSET, PLACE, MUT, metadata(dynamicSize(SIZE), PTR_OFFSET, ORIGIN_SIZE)) ... // TYPEMAP @@ -1212,9 +1350,9 @@ The original metadata is therefore already stored as `staticSize` to avoid havin // andBool notBool hasMetadata(_TY_TARGET, TYPEMAP) // [preserves-definedness] // valid type map indexing and sort coercion - rule #cast(AllocRef(ID, PROJS, staticSize(SIZE)), castKindPointerCoercion(pointerCoercionUnsize), _TY_SOURCE, _TY_TARGET) + rule #cast(AllocRef(ID, PROJS, metadata(staticSize(SIZE), OFF, ORIG)), castKindPointerCoercion(pointerCoercionUnsize), _TY_SOURCE, _TY_TARGET) => - AllocRef(ID, PROJS, dynamicSize(SIZE)) + AllocRef(ID, PROJS, metadata(dynamicSize(SIZE), OFF, ORIG)) ... ``` @@ -1296,7 +1434,7 @@ into the `` heap where all allocated constants have been decoded at prog _TY, typeInfoRefType(POINTEE_TY) ) - => AllocRef(ALLOC_ID, .ProjectionElems, #metadata(POINTEE_TY)) + => AllocRef(ALLOC_ID, .ProjectionElems, metadata(#metadataSize(POINTEE_TY), 0, #metadataSize(POINTEE_TY))) ... requires isValue(lookupAlloc(ALLOC_ID)) @@ -1312,7 +1450,7 @@ into the `` heap where all allocated constants have been decoded at prog _TY, typeInfoRefType(_) ) - => AllocRef(ALLOC_ID, .ProjectionElems, dynamicSize(Bytes2Int(substrBytes(BYTES, 8, 16), LE, Unsigned)) ) + => AllocRef(ALLOC_ID, .ProjectionElems, metadata(dynamicSize(Bytes2Int(substrBytes(BYTES, 8, 16), LE, Unsigned)), 0, dynamicSize(Bytes2Int(substrBytes(BYTES, 8, 16), LE, Unsigned)) )) // assumes usize == u64 ... @@ -1707,8 +1845,9 @@ The unary operation `unOpPtrMetadata`, when given a reference or pointer to a sl * For values with statically-known size, this operation returns a _unit_ value. However, these calls should not occur in practical programs. ```k - rule #applyUnOp(unOpPtrMetadata, Reference(_, _, _, dynamicSize(SIZE))) => Integer(SIZE, 64, false) ... - rule #applyUnOp(unOpPtrMetadata, PtrLocal(_, _, _, ptrEmulation(dynamicSize(SIZE)))) => Integer(SIZE, 64, false) ... + rule #applyUnOp(unOpPtrMetadata, Reference(_, _, _, metadata(dynamicSize(SIZE), _, _))) => Integer(SIZE, 64, false) ... + rule #applyUnOp(unOpPtrMetadata, PtrLocal(_, _, _, metadata(dynamicSize(SIZE), _, _))) => Integer(SIZE, 64, false) ... + rule #applyUnOp(unOpPtrMetadata, AllocRef( _ , _, metadata(dynamicSize(SIZE), _, _))) => Integer(SIZE, 64, false) ... // could add a rule for cases without metadata ``` @@ -1749,16 +1888,45 @@ Raw pointer comparisons ignore mutability, but require the address and metadata #### Pointer Artithmetic -Currently only supporting a trivial case where `binOpOffset` applies an offset of `0`, returning the same pointer. +Addding an offset is currently restricted to unsigned values of an length, this may be too restrictive TODO Check. +A pointer is offset by adding the magnitude of the `Integer` provided, as along as it is within the bounds of the pointer. +It is valid to offset to the end of the pointer, however I believe it in not valid to read from there TODO: Check. +A trivial case where `binOpOffset` applies an offset of `0` is added with higher priority as it is returning the same pointer. ```k - rule #applyBinOp( - binOpOffset, - PtrLocal( STACK_DEPTH , PLACE , MUT, POINTEE_METADATA ), - Integer(0, _WIDTH, _SIGNED), // Trivial case when adding 0 - _CHECKED) - => - PtrLocal( STACK_DEPTH , PLACE , MUT, POINTEE_METADATA ) + // Trivial case when adding 0 - valid for any pointer + rule #applyBinOp( + binOpOffset, + PtrLocal( STACK_DEPTH , PLACE , MUT, POINTEE_METADATA ), + Integer(VAL, _WIDTH, _SIGNED), // Trivial case when adding 0 + _CHECKED) + => + PtrLocal( STACK_DEPTH , PLACE , MUT, POINTEE_METADATA ) + requires VAL ==Int 0 + [preserves-definedness, priority(40)] + + // Check offset bounds against origin pointer with dynamicSize metadata + rule #applyBinOp( + binOpOffset, + PtrLocal( STACK_DEPTH , PLACE , MUT, metadata(CURRENT_SIZE, CURRENT_OFFSET, dynamicSize(ORIGIN_SIZE)) ), + Integer(OFFSET_VAL, _WIDTH, false), // unsigned offset + _CHECKED) + => + PtrLocal( STACK_DEPTH , PLACE , MUT, metadata(CURRENT_SIZE, CURRENT_OFFSET +Int OFFSET_VAL, dynamicSize(ORIGIN_SIZE)) ) + requires OFFSET_VAL >=Int 0 + andBool CURRENT_OFFSET +Int OFFSET_VAL <=Int ORIGIN_SIZE + [preserves-definedness] + + // Check offset bounds against origin pointer with staticSize metadata + rule #applyBinOp( + binOpOffset, + PtrLocal( STACK_DEPTH , PLACE , MUT, metadata(CURRENT_SIZE, CURRENT_OFFSET, staticSize(ORIGIN_SIZE)) ), + Integer(OFFSET_VAL, _WIDTH, false), // unsigned offset + _CHECKED) + => + PtrLocal( STACK_DEPTH , PLACE , MUT, metadata(CURRENT_SIZE, CURRENT_OFFSET +Int OFFSET_VAL, staticSize(ORIGIN_SIZE)) ) + requires OFFSET_VAL >=Int 0 + andBool CURRENT_OFFSET +Int OFFSET_VAL <=Int ORIGIN_SIZE [preserves-definedness] ``` diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md b/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md index a37b2c72c..ffef14c2b 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md @@ -99,11 +99,11 @@ Known element sizes for common types: // thin and fat pointers rule #elemSize(typeInfoRefType(TY)) => #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) - requires dynamicSize(1) ==K #metadata(TY) + requires dynamicSize(1) ==K #metadataSize(TY) rule #elemSize(typeInfoRefType(_)) => 2 *Int #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) [owise] rule #elemSize(typeInfoPtrType(TY)) => #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) - requires dynamicSize(1) ==K #metadata(TY) + requires dynamicSize(1) ==K #metadataSize(TY) rule #elemSize(typeInfoPtrType(_)) => 2 *Int #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) [owise] diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/types.md b/kmir/src/kmir/kdist/mir-semantics/rt/types.md index 0a7dd449f..b46ce90ff 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/types.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/types.md @@ -104,7 +104,7 @@ To make this function total, an optional `MaybeTy` is used. ## Static and Dynamic Metadata for Types References to data on the heap or stack may require metadata, most commonly the size of slices, which is not statically known. -The helper function `#metadata` determines whether or not a given `TypeInfo` requires size information or other metadata (also see `Metadata` sort in `value.md`). +The helper function `#metadataSize` determines whether or not a given `TypeInfo` requires size information or other metadata (also see `MetadataSize` sort in `value.md`). To avoid repeated lookups, static array sizes are also stored as metadata (for `Unsize` casts). NB that the need for metadata is determined for the _pointee_ type, not the pointer type. @@ -113,18 +113,18 @@ A [similar function exists in `rustc`](https://doc.rust-lang.org/nightly/nightly Slices, `str`s and dynamic types require it, and any `Ty` that `is_sized` does not. ```k - syntax Metadata ::= #metadata ( Ty , ProjectionElems ) [function, total] - | #metadata ( MaybeTy ) [function, total] - | #metadataAux ( TypeInfo ) [function, total] - // ------------------------------------------------------------ - rule #metadata(TY, PROJS) => #metadata(getTyOf(TY, PROJS)) - - rule #metadata(TyUnknown) => noMetadata - rule #metadata(TY) => #metadataAux(lookupTy(TY)) - - rule #metadataAux(typeInfoArrayType(_, noTyConst )) => dynamicSize(1) - rule #metadataAux(typeInfoArrayType(_, someTyConst(tyConst(CONST, _)))) => staticSize(readTyConstInt(CONST)) - rule #metadataAux( _OTHER ) => noMetadata [owise] + syntax MetadataSize ::= #metadataSize ( Ty , ProjectionElems ) [function, total] + | #metadataSize ( MaybeTy ) [function, total] + | #metadataSizeAux ( TypeInfo ) [function, total] + // -------------------------------------------------------------------------------------- + rule #metadataSize(TY, PROJS) => #metadataSize(getTyOf(TY, PROJS)) + + rule #metadataSize(TyUnknown) => noMetadataSize + rule #metadataSize(TY) => #metadataSizeAux(lookupTy(TY)) + + rule #metadataSizeAux(typeInfoArrayType(_, noTyConst )) => dynamicSize(1) + rule #metadataSizeAux(typeInfoArrayType(_, someTyConst(tyConst(CONST, _)))) => staticSize(readTyConstInt(CONST)) + rule #metadataSizeAux( _OTHER ) => noMetadataSize [owise] ``` diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/value.md b/kmir/src/kmir/kdist/mir-semantics/rt/value.md index 22c4e4220..f45ca88b7 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/value.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/value.md @@ -41,13 +41,13 @@ The special `Moved` value represents values that have been used and should not b // value, bit-width for f16-f128 | Reference( Int , Place , Mutability , Metadata ) [symbol(Value::Reference)] - // stack depth (initially 0), place, borrow kind, dynamic size if applicable + // stack depth (initially 0), place, borrow kind, metadata (size, pointer offset, origin size) | Range( List ) [symbol(Value::Range)] // homogenous values for array/slice - | PtrLocal( Int , Place , Mutability, PtrEmulation ) + | PtrLocal( Int , Place , Mutability, Metadata ) [symbol(Value::PtrLocal)] // pointer to a local TypedValue (on the stack) - // first 3 fields are the same as in Reference, plus pointee metadata + // fields are the same as in Reference | AllocRef ( AllocId , ProjectionElems , Metadata ) [symbol(Value::AllocRef)] // reference to static allocation, by AllocId, possibly projected, carrying metadata if applicable @@ -65,21 +65,18 @@ A _thin pointer_ in Rust is simply an address of data in the heap or on the stac A _fat pointer_ in Rust is a pair of an address and [additional metadata about the pointee](https://doc.rust-lang.org/std/ptr/trait.Pointee.html#associatedtype.Metadata). This is necessary for dynamically-sized pointee types (most prominently slices) and dynamic trait objects. -References to arrays and slices carry `Metadata`. -For array types with statically-known size, the metadata is set to `staticSize` to avoid repeated type lookups. -Other types without metadata use `noMetadata`. +References to arrays and slices carry `Metadata`. In Rust `Metadata` is only a size, but we need more information to detect UB, so we track `(Size, Ptr Offset, Origin Size)` +For array types with statically-known size, the metadata size is set to `staticSize` to avoid repeated type lookups. +Other types without metadata use `noMetadataSize`. ```k - syntax Metadata ::= "noMetadata" [symbol(noMetadata)] - | staticSize ( Int ) [symbol(staticSize)] - | dynamicSize ( Int ) [symbol(dynamicSize)] -``` - -A pointer in Rust carries the same metadata. + // Origin size is since a pointer might not have size iteself but should be in bounds of an aggregate origin + syntax Metadata ::= metadata ( MetadataSize, Int, MetadataSize) [symbol(Metadata)] + // ( Size, Pointer Offset, Origin Size ) - -```k - syntax PtrEmulation ::= ptrEmulation ( Metadata ) [symbol(PtrEmulation)] + syntax MetadataSize ::= "noMetadataSize" [symbol(noMetadataSize)] + | staticSize ( Int ) [symbol(staticSize)] + | dynamicSize ( Int ) [symbol(dynamicSize)] ``` ## Local variables diff --git a/kmir/src/kmir/value.py b/kmir/src/kmir/value.py index ee3275de9..af16795cd 100644 --- a/kmir/src/kmir/value.py +++ b/kmir/src/kmir/value.py @@ -90,24 +90,31 @@ def to_kast(self) -> KInner: class AllocRefValue(Value): alloc_id: AllocId # projection_elems: tuple[ProjectionElem, ...] - metadata: Metadata + metadata: MetadataSize def to_kast(self) -> KInner: return KApply( 'Value::AllocRef', KApply('allocId', intToken(self.alloc_id)), KApply('ProjectionElems::empty'), # TODO - self.metadata.to_kast(), + KApply( + 'Metadata', + ( + self.metadata.to_kast(), + intToken(0), + self.metadata.to_kast(), + ), + ), ) -class Metadata(ABC): +class MetadataSize(ABC): @abstractmethod def to_kast(self) -> KInner: ... @dataclass -class NoMetadata(Metadata): +class NoMetadata(MetadataSize): def to_kast(self) -> KInner: return KApply('noMetadata') @@ -116,7 +123,7 @@ def to_kast(self) -> KInner: @dataclass -class StaticSize(Metadata): +class StaticSize(MetadataSize): size: int def to_kast(self) -> KInner: @@ -124,7 +131,7 @@ def to_kast(self) -> KInner: @dataclass -class DynamicSize(Metadata): +class DynamicSize(MetadataSize): size: int def to_kast(self) -> KInner: diff --git a/kmir/src/tests/integration/data/exec-smir/allocs/array_const_compare.state b/kmir/src/tests/integration/data/exec-smir/allocs/array_const_compare.state index 3e8bde783..5c2707c89 100644 --- a/kmir/src/tests/integration/data/exec-smir/allocs/array_const_compare.state +++ b/kmir/src/tests/integration/data/exec-smir/allocs/array_const_compare.state @@ -32,12 +32,12 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , staticSize ( 3 ) ) ) - ListItem ( AllocRef ( allocId ( 1 ) , .ProjectionElems , staticSize ( 3 ) ) ) ) , ty ( 86 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( staticSize ( 3 ) , 0 , staticSize ( 3 ) ) ) ) + ListItem ( AllocRef ( allocId ( 1 ) , .ProjectionElems , metadata ( staticSize ( 3 ) , 0 , staticSize ( 3 ) ) ) ) ) , ty ( 86 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , staticSize ( 3 ) ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 1 ) , .ProjectionElems , staticSize ( 3 ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( staticSize ( 3 ) , 0 , staticSize ( 3 ) ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 1 ) , .ProjectionElems , metadata ( staticSize ( 3 ) , 0 , staticSize ( 3 ) ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 30 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 69 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 68 ) , mutabilityNot ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/allocs/array_nest_compare.state b/kmir/src/tests/integration/data/exec-smir/allocs/array_nest_compare.state index a32dddf86..6c3fa5051 100644 --- a/kmir/src/tests/integration/data/exec-smir/allocs/array_nest_compare.state +++ b/kmir/src/tests/integration/data/exec-smir/allocs/array_nest_compare.state @@ -36,12 +36,12 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , staticSize ( 2 ) ) ) - ListItem ( AllocRef ( allocId ( 1 ) , .ProjectionElems , staticSize ( 2 ) ) ) ) , ty ( 107 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( staticSize ( 2 ) , 0 , staticSize ( 2 ) ) ) ) + ListItem ( AllocRef ( allocId ( 1 ) , .ProjectionElems , metadata ( staticSize ( 2 ) , 0 , staticSize ( 2 ) ) ) ) ) , ty ( 107 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 28 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 28 ) , mutabilityMut ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , staticSize ( 2 ) ) , ty ( 28 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 1 ) , .ProjectionElems , staticSize ( 2 ) ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( staticSize ( 2 ) , 0 , staticSize ( 2 ) ) ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 1 ) , .ProjectionElems , metadata ( staticSize ( 2 ) , 0 , staticSize ( 2 ) ) ) , ty ( 28 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 30 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 85 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 84 ) , mutabilityNot ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.state b/kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.state index aa870846e..96b5c29ae 100644 --- a/kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.state +++ b/kmir/src/tests/integration/data/exec-smir/allocs/enum-two-refs-fail.state @@ -1,6 +1,6 @@ - #traverseProjection ( toLocal ( 13 ) , thunk ( #decodeConstant ( constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 1 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty ( 25 ) , typeInfoRefType ( ty ( 99 ) ) ) ) , projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 0 ) , ty ( 37 ) ) .ProjectionElems , .Contexts ) ~> #forRef ( mutabilityNot , noMetadata ) ~> #freezer#setLocalValue(_,_)_RT-DATA_KItem_Place_Evaluation1_ ( place (... local: local ( 4 ) , projection: .ProjectionElems ) ~> .K ) ~> #execStmts ( statement (... kind: statementKindAssign (... place: place (... local: local ( 14 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 5 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 14 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 1 ) , ty ( 45 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 15 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 1 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 6 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 15 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 0 ) , ty ( 37 ) ) .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 16 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 1 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 7 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 16 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 1 ) , ty ( 45 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 9 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 4 ) , projection: .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 10 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 6 ) , projection: .ProjectionElems ) ) ) , span: span ( 145 ) ) .Statements ) ~> #execTerminator ( terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 145 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 93 ) , id: mirConstId ( 47 ) ) ) ) , args: operandMove ( place (... local: local ( 9 ) , projection: .ProjectionElems ) ) operandMove ( place (... local: local ( 10 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 8 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 1 ) ) , unwind: unwindActionContinue ) , span: span ( 145 ) ) ) ~> .K + #traverseProjection ( toLocal ( 13 ) , thunk ( #decodeConstant ( constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 1 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty ( 25 ) , typeInfoRefType ( ty ( 99 ) ) ) ) , projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 0 ) , ty ( 37 ) ) .ProjectionElems , .Contexts ) ~> #forRef ( mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ~> #freezer#setLocalValue(_,_)_RT-DATA_KItem_Place_Evaluation1_ ( place (... local: local ( 4 ) , projection: .ProjectionElems ) ~> .K ) ~> #execStmts ( statement (... kind: statementKindAssign (... place: place (... local: local ( 14 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 5 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 14 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 1 ) , ty ( 45 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 15 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 1 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 6 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 15 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 0 ) , ty ( 37 ) ) .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 16 ) , projection: .ProjectionElems ) , rvalue: rvalueCopyForDeref ( place (... local: local ( 3 ) , projection: projectionElemField ( fieldIdx ( 1 ) , ty ( 25 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 7 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 16 ) , projection: projectionElemDeref projectionElemDowncast ( variantIdx ( 0 ) ) projectionElemField ( fieldIdx ( 1 ) , ty ( 45 ) ) .ProjectionElems ) ) ) , span: span ( 147 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 9 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 4 ) , projection: .ProjectionElems ) ) ) , span: span ( 145 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 10 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 6 ) , projection: .ProjectionElems ) ) ) , span: span ( 145 ) ) .Statements ) ~> #execTerminator ( terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 145 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 93 ) , id: mirConstId ( 47 ) ) ) ) , args: operandMove ( place (... local: local ( 9 ) , projection: .ProjectionElems ) ) operandMove ( place (... local: local ( 10 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 8 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 1 ) ) , unwind: unwindActionContinue ) , span: span ( 145 ) ) ) ~> .K noReturn diff --git a/kmir/src/tests/integration/data/exec-smir/arrays/array_inlined.state b/kmir/src/tests/integration/data/exec-smir/arrays/array_inlined.state index a4e52f93f..7e5876270 100644 --- a/kmir/src/tests/integration/data/exec-smir/arrays/array_inlined.state +++ b/kmir/src/tests/integration/data/exec-smir/arrays/array_inlined.state @@ -71,16 +71,16 @@ ListItem ( typedValue ( Moved , ty ( 42 ) , mutabilityMut ) ) ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Moved ) ListItem ( Moved ) ) , ty ( 47 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 27 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) ) , ty ( 48 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 27 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 48 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( -200 , 32 , true ) , ty ( 16 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( -2 , 32 , true ) , ty ( 16 ) , mutabilityMut ) ) ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Moved ) ListItem ( Moved ) ) , ty ( 47 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 27 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 27 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 42 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 16 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 16 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/arrays/array_write.state b/kmir/src/tests/integration/data/exec-smir/arrays/array_write.state index b5fd26e06..861180b8d 100644 --- a/kmir/src/tests/integration/data/exec-smir/arrays/array_write.state +++ b/kmir/src/tests/integration/data/exec-smir/arrays/array_write.state @@ -39,7 +39,7 @@ ListItem ( typedValue ( Integer ( 0 , 64 , false ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 4 , 64 , false ) , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 30 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 1 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 31 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 1 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 31 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 1 , 64 , false ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 4 , 64 , false ) , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 30 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/intrinsic/blackbox.state b/kmir/src/tests/integration/data/exec-smir/intrinsic/blackbox.state index 42d20c987..b05e88c0e 100644 --- a/kmir/src/tests/integration/data/exec-smir/intrinsic/blackbox.state +++ b/kmir/src/tests/integration/data/exec-smir/intrinsic/blackbox.state @@ -33,12 +33,12 @@ ListItem ( typedValue ( Integer ( 11 , 32 , false ) , ty ( 26 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , noMetadata ) ) ) , ty ( 47 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 47 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 41 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/intrinsic/raw_eq_simple.state b/kmir/src/tests/integration/data/exec-smir/intrinsic/raw_eq_simple.state index 95201e717..baeb2b64a 100644 --- a/kmir/src/tests/integration/data/exec-smir/intrinsic/raw_eq_simple.state +++ b/kmir/src/tests/integration/data/exec-smir/intrinsic/raw_eq_simple.state @@ -32,8 +32,8 @@ ListItem ( typedValue ( Integer ( 42 , 32 , true ) , ty ( 16 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 42 , 32 , true ) , ty ( 16 ) , mutabilityNot ) ) ListItem ( typedValue ( BoolVal ( true ) , ty ( 28 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 29 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 2 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 29 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 2 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 30 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/niche-enum/niche-enum.state b/kmir/src/tests/integration/data/exec-smir/niche-enum/niche-enum.state index df69429dc..2f67853c8 100644 --- a/kmir/src/tests/integration/data/exec-smir/niche-enum/niche-enum.state +++ b/kmir/src/tests/integration/data/exec-smir/niche-enum/niche-enum.state @@ -38,35 +38,35 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 3 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( AllocRef ( allocId ( 2 ) , .ProjectionElems , noMetadata ) ) ) , ty ( 51 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 3 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( AllocRef ( allocId ( 2 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 51 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , .List ) , ty ( 46 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 3 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 2 ) , .ProjectionElems , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 3 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 2 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 44 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 38 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 37 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( AllocRef ( allocId ( 3 ) , .ProjectionElems , noMetadata ) ) ) , ty ( 51 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( AllocRef ( allocId ( 3 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 51 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Aggregate ( variantIdx ( 1 ) , ListItem ( Aggregate ( variantIdx ( 0 ) , .List ) ) ) , ty ( 46 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 3 ) , .ProjectionElems , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 13 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 3 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 44 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 38 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 37 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 23 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( AllocRef ( allocId ( 4 ) , .ProjectionElems , noMetadata ) ) ) , ty ( 51 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 23 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( AllocRef ( allocId ( 4 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 51 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Aggregate ( variantIdx ( 1 ) , ListItem ( Aggregate ( variantIdx ( 1 ) , .List ) ) ) , ty ( 46 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 23 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( AllocRef ( allocId ( 4 ) , .ProjectionElems , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 23 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 4 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 44 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 38 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 37 ) , mutabilityNot ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/pointers/pointer-cast-length-test-fail.state b/kmir/src/tests/integration/data/exec-smir/pointers/pointer-cast-length-test-fail.state index 70178511b..6e2c445d7 100644 --- a/kmir/src/tests/integration/data/exec-smir/pointers/pointer-cast-length-test-fail.state +++ b/kmir/src/tests/integration/data/exec-smir/pointers/pointer-cast-length-test-fail.state @@ -41,7 +41,7 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , dynamicSize ( 8 ) ) , ty ( 26 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( dynamicSize ( 8 ) , 0 , noMetadataSize ) ) , ty ( 26 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 38 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 29 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) @@ -49,13 +49,13 @@ ListItem ( Integer ( 42 , 8 , false ) ) ListItem ( Integer ( 42 , 8 , false ) ) ListItem ( Integer ( 42 , 8 , false ) ) ) , ty ( 40 ) , mutabilityNot ) ) - ListItem ( typedValue ( PtrLocal ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , ptrEmulation ( staticSize ( 4 ) ) ) , ty ( 35 ) , mutabilityMut ) ) + ListItem ( typedValue ( PtrLocal ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 4 ) , 0 , noMetadataSize ) ) , ty ( 35 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 29 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 41 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) - ListItem ( typedValue ( PtrLocal ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , ptrEmulation ( staticSize ( 4 ) ) ) , ty ( 36 ) , mutabilityNot ) ) + ListItem ( typedValue ( PtrLocal ( 1 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 4 ) , 0 , noMetadataSize ) ) , ty ( 36 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 1 , 64 , false ) , ty ( 29 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 4 , 64 , false ) , ty ( 29 ) , mutabilityMut ) ) @@ -64,10 +64,10 @@ ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 41 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , dynamicSize ( 4 ) ) , ty ( 26 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , staticSize ( 4 ) ) , ty ( 41 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( dynamicSize ( 4 ) , 0 , noMetadataSize ) ) , ty ( 26 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 4 ) , 0 , noMetadataSize ) ) , ty ( 41 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 42 ) , mutabilityNot ) ) - ListItem ( typedValue ( PtrLocal ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , ptrEmulation ( staticSize ( 9 ) ) ) , ty ( 37 ) , mutabilityMut ) ) + ListItem ( typedValue ( PtrLocal ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 9 ) , 0 , noMetadataSize ) ) , ty ( 37 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 29 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 26 ) , mutabilityMut ) ) @@ -83,7 +83,7 @@ ListItem ( Integer ( 42 , 8 , false ) ) ) , ty ( 30 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 1 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , staticSize ( 8 ) ) , ty ( 31 ) , mutabilityNot ) ) ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 8 ) , 0 , noMetadataSize ) ) , ty ( 31 ) , mutabilityNot ) ) ) ) ListItem ( StackFrame ( ty ( -1 ) , place (... local: local ( -1 ) , projection: .ProjectionElems ) , noBasicBlockIdx , unwindActionUnreachable , .List ) ) \ No newline at end of file diff --git a/kmir/src/tests/integration/data/exec-smir/references/array_elem_ref.state b/kmir/src/tests/integration/data/exec-smir/references/array_elem_ref.state index 84d76d60d..c90e1b425 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/array_elem_ref.state +++ b/kmir/src/tests/integration/data/exec-smir/references/array_elem_ref.state @@ -33,11 +33,11 @@ ListItem ( Integer ( 0 , 32 , false ) ) ListItem ( Integer ( 0 , 32 , false ) ) ListItem ( Integer ( 0 , 32 , false ) ) ) , ty ( 34 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 3 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 27 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 3 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 27 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 3 , 64 , false ) , ty ( 31 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 4 , 64 , false ) , ty ( 31 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 35 ) , mutabilityMut ) ) - ListItem ( typedValue ( PtrLocal ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 3 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityNot , ptrEmulation ( noMetadata ) ) , ty ( 30 ) , mutabilityNot ) ) + ListItem ( typedValue ( PtrLocal ( 0 , place (... local: local ( 1 ) , projection: projectionElemConstantIndex (... offset: 3 , minLength: 0 , fromEnd: false ) .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 30 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 1 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 1 ) , mutabilityNot ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/doubleRef.state b/kmir/src/tests/integration/data/exec-smir/references/doubleRef.state index b0b2b9148..de694867d 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/doubleRef.state +++ b/kmir/src/tests/integration/data/exec-smir/references/doubleRef.state @@ -32,18 +32,18 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 22 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 2 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 22 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 2 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 21 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 34 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 21 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 24 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 24 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 11 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 25 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 22 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 11 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 22 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 34 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 22 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 22 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/mutableRef.state b/kmir/src/tests/integration/data/exec-smir/references/mutableRef.state index bfef72bc6..951a10279 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/mutableRef.state +++ b/kmir/src/tests/integration/data/exec-smir/references/mutableRef.state @@ -33,10 +33,10 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 22 , 8 , true ) , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 1 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 28 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 29 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 29 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/refAsArg.state b/kmir/src/tests/integration/data/exec-smir/references/refAsArg.state index db3bb356c..043aae9d7 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/refAsArg.state +++ b/kmir/src/tests/integration/data/exec-smir/references/refAsArg.state @@ -31,7 +31,7 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 29 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 30 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/refAsArg2.state b/kmir/src/tests/integration/data/exec-smir/references/refAsArg2.state index db3bb356c..043aae9d7 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/refAsArg2.state +++ b/kmir/src/tests/integration/data/exec-smir/references/refAsArg2.state @@ -31,7 +31,7 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 29 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 30 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/refReturned.state b/kmir/src/tests/integration/data/exec-smir/references/refReturned.state index 080d3afa0..7301205f2 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/refReturned.state +++ b/kmir/src/tests/integration/data/exec-smir/references/refReturned.state @@ -30,8 +30,8 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 28 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 28 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 29 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 30 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/simple.state b/kmir/src/tests/integration/data/exec-smir/references/simple.state index d3c43f58c..86f6e5353 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/simple.state +++ b/kmir/src/tests/integration/data/exec-smir/references/simple.state @@ -29,7 +29,7 @@ ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 27 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 27 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 42 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 28 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 29 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/exec-smir/references/weirdRefs.state b/kmir/src/tests/integration/data/exec-smir/references/weirdRefs.state index f0da321f4..454f37867 100644 --- a/kmir/src/tests/integration/data/exec-smir/references/weirdRefs.state +++ b/kmir/src/tests/integration/data/exec-smir/references/weirdRefs.state @@ -39,29 +39,29 @@ ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Integer ( 43 , 8 , true ) ) ListItem ( BoolVal ( true ) ) ListItem ( Integer ( 43 , 64 , false ) ) ) , ty ( 30 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 31 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 31 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 32 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 31 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 33 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 31 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 5 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 33 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 32 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) ) ) , ty ( 34 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 29 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 9 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 35 ) , mutabilityNot ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 34 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 9 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 35 ) , mutabilityNot ) ) ListItem ( typedValue ( Integer ( 43 , 8 , true ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( newLocal ( ty ( 32 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 2 ) , ty ( 26 ) ) .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 36 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 2 ) , ty ( 26 ) ) .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 36 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 25 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 32 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 26 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 32 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 31 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 29 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 29 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 29 ) , mutabilityMut ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , noMetadata ) , ty ( 29 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 2 ) ) .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 31 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityMut ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityMut , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 29 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/prove-rs/offset_read.rs b/kmir/src/tests/integration/data/prove-rs/offset_read.rs new file mode 100644 index 000000000..1cf15eb01 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/offset_read.rs @@ -0,0 +1,5 @@ +fn main() { + let arr = [11, 22, 33]; + let subslice = &arr[1..]; + assert!(subslice == [22, 33]); +} \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/offset_struct_field_read.rs b/kmir/src/tests/integration/data/prove-rs/offset_struct_field_read.rs new file mode 100644 index 000000000..f5294fd11 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/offset_struct_field_read.rs @@ -0,0 +1,9 @@ +struct Foo { + arr: [u16; 3], +} + +fn main() { + let foo = Foo { arr: [11, 22, 33] }; + let subslice = &foo.arr[1..]; + assert!(subslice == [22, 33]); +} \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/offset_struct_field_write.rs b/kmir/src/tests/integration/data/prove-rs/offset_struct_field_write.rs new file mode 100644 index 000000000..17aa28581 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/offset_struct_field_write.rs @@ -0,0 +1,10 @@ +struct Foo { + arr: [u16; 3], +} + +fn main() { + let mut foo = Foo { arr: [11, 22, 33] }; + let subslice = &mut foo.arr[1..]; + subslice[0] = 44; + assert!(foo.arr == [11, 44, 33]); +} \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/offset_write.rs b/kmir/src/tests/integration/data/prove-rs/offset_write.rs new file mode 100644 index 000000000..994a51c81 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/offset_write.rs @@ -0,0 +1,6 @@ +fn main() { + let mut arr = [11, 22, 33]; + let subslice = &mut arr[1..]; + subslice[0] = 44; + assert!(arr == [11, 44, 33]); +} \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/slice-split-at.rs b/kmir/src/tests/integration/data/prove-rs/slice-split-at.rs new file mode 100644 index 000000000..bfc1d6394 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/slice-split-at.rs @@ -0,0 +1,27 @@ +fn main() { + let arr: [u8; 2] = [42, 255]; + let slice = arr.as_slice(); + let (left, right) = slice.split_at(1); + assert!(left == [42]); + assert!(right == [255]); + + let arr: [u8; 3] = [42, 255, 66]; + let slice = arr.as_slice(); + let (left, right) = slice.split_at(1); + assert!(left == [42]); + assert!(right == [255, 66]); + + // Empty Case RHS + let arr: [u8; 3] = [42, 255, 66]; + let slice = arr.as_slice(); + let (left, right) = slice.split_at(3); + assert!(left == [42, 255, 66]); + assert!(right == []); + + // Empty Case LHS + let arr: [u8; 3] = [42, 255, 66]; + let slice = arr.as_slice(); + let (left, right) = slice.split_at(0); + assert!(left == []); + assert!(right == [42, 255, 66]); +} diff --git a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-1.expected b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-1.expected index b5d442e5f..d4175ed23 100644 --- a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-1.expected +++ b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-1.expected @@ -60,13 +60,13 @@ ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 18 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) ) , ty ( 22 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 22 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( BoolVal ( false ) , ty ( 18 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-4.expected b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-4.expected index f90e3829c..fe0fc56a4 100644 --- a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-4.expected +++ b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-4.expected @@ -60,13 +60,13 @@ ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 18 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) ) , ty ( 22 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 22 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( BoolVal ( false ) , ty ( 18 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-7.expected b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-7.expected index 34ed3e3e2..f39dc9787 100644 --- a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-7.expected +++ b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-7.expected @@ -60,13 +60,13 @@ ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 18 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) ) , ty ( 22 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 22 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( BoolVal ( false ) , ty ( 18 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) diff --git a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-9.expected b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-9.expected index e5c5e76da..3bd535f28 100644 --- a/kmir/src/tests/integration/data/run-smir-random/simple-types/final-9.expected +++ b/kmir/src/tests/integration/data/run-smir-random/simple-types/final-9.expected @@ -60,13 +60,13 @@ ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 18 ) , mutabilityMut ) ) ListItem ( newLocal ( ty ( 12 ) , mutabilityMut ) ) - ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) - ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) ) ) , ty ( 22 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) + ListItem ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) ) ) , ty ( 22 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 2 ) , mutabilityMut ) ) ListItem ( typedValue ( BoolVal ( false ) , ty ( 18 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) - ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , noMetadata ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 22 ) , projection: .ProjectionElems ) , mutabilityNot , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 2 ) , mutabilityNot ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) ListItem ( typedValue ( Moved , ty ( 18 ) , mutabilityMut ) ) From c8d92608c7e2fe2c388248898f08fa40a57721cc Mon Sep 17 00:00:00 2001 From: JianHong Zhao Date: Mon, 27 Oct 2025 15:01:48 +0800 Subject: [PATCH 2/2] feat(decode): runtime support for structures (#769) --- kmir/src/kmir/kdist/mir-semantics/rt/data.md | 2 +- .../kmir/kdist/mir-semantics/rt/decoding.md | 98 +- kmir/src/kmir/kdist/mir-semantics/ty.md | 6 +- .../newtype-pubkey/newtype-pubkey.rs | 24 + .../newtype-pubkey/newtype-pubkey.smir.json | 3406 ++++++++ .../newtype-pubkey/newtype-pubkey.state | 71 + .../exec-smir/struct-multi/struct-multi.rs | 19 + .../struct-multi/struct-multi.smir.json | 7020 +++++++++++++++++ .../exec-smir/struct-multi/struct-multi.state | 58 + .../show/interior-mut-fail.main.expected | 6 +- .../src/tests/integration/test_integration.py | 12 + scripts/generate-smir-json.sh | 16 + 12 files changed, 10728 insertions(+), 10 deletions(-) create mode 100644 kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs create mode 100644 kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.smir.json create mode 100644 kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.state create mode 100644 kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs create mode 100644 kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.smir.json create mode 100644 kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.state diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/data.md b/kmir/src/kmir/kdist/mir-semantics/rt/data.md index 5656f4a63..c54f0c2f2 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/data.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/data.md @@ -1410,7 +1410,7 @@ Zero-sized types can be decoded trivially into their respective representation. ```k // zero-sized struct - rule #decodeConstant(constantKindZeroSized, _TY, typeInfoStructType(_, _, _)) + rule #decodeConstant(constantKindZeroSized, _TY, typeInfoStructType(_, _, _, _)) => Aggregate(variantIdx(0), .List) ... // zero-sized tuple rule #decodeConstant(constantKindZeroSized, _TY, typeInfoTupleType(_)) diff --git a/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md b/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md index ffef14c2b..ff9654535 100644 --- a/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md +++ b/kmir/src/kmir/kdist/mir-semantics/rt/decoding.md @@ -16,6 +16,7 @@ requires "value.md" requires "numbers.md" module RT-DECODING + imports INT imports BOOL imports MAP @@ -72,6 +73,66 @@ rule #decodeValue(BYTES, typeInfoArrayType(ELEMTY, noTyConst)) => #decodeSliceAllocation(BYTES, lookupTy(ELEMTY)) ``` +### Struct decoding + +Structs can have non-trivial layouts: field offsets may not match declaration order, and there may be padding. +Decoding is only performed when explicit layout offsets are available; otherwise we leave the term as `UnableToDecode` via the default rule. This avoids incorrectly decoding data when field reordering or padding is present. + +When using layout offsets we always return fields in declaration order within the `Aggregate` (variant 0), regardless of the physical order in memory. + +```k +// --------------------------------------------------------------------------- +// Struct decoding rules (top level) +// --------------------------------------------------------------------------- +// Use the offsets when they are provided and the input length is sufficient. +rule #decodeValue(BYTES, typeInfoStructType(_, _, TYS, LAYOUT)) + => Aggregate(variantIdx(0), #decodeStructFieldsWithOffsets(BYTES, TYS, #structOffsets(LAYOUT))) + requires #structOffsets(LAYOUT) =/=K .MachineSizes + andBool 0 <=Int #neededBytesForOffsets(TYS, #structOffsets(LAYOUT)) + andBool lengthBytes(BYTES) >=Int #neededBytesForOffsets(TYS, #structOffsets(LAYOUT)) + [preserves-definedness] + +// --------------------------------------------------------------------------- +// Offsets and helpers (used by the rules above) +// --------------------------------------------------------------------------- +// MachineSize is in bits in the ABI; convert to bytes for slicing. +syntax Int ::= #msBytes ( MachineSize ) [function, total] +rule #msBytes(machineSize(mirInt(NBITS))) => NBITS /Int 8 [preserves-definedness] +rule #msBytes(machineSize(NBITS)) => NBITS /Int 8 [owise, preserves-definedness] + +// Extract field offsets from the struct layout when available (Arbitrary only). +syntax MachineSizes ::= #structOffsets ( MaybeLayoutShape ) [function, total] +rule #structOffsets(someLayoutShape(layoutShape(fieldsShapeArbitrary(mk(OFFSETS)), _, _, _, _))) => OFFSETS +rule #structOffsets(noLayoutShape) => .MachineSizes +rule #structOffsets(_) => .MachineSizes [owise] + +// Minimum number of input bytes required to decode all fields by the chosen offsets. +// Uses builtin maxInt to compute max(offset + size). The lists of types and +// offsets must have the same length; if not, this function returns -1 to signal +// an invalid layout for decoding. +syntax Int ::= #neededBytesForOffsets ( Tys , MachineSizes ) [function, total] +rule #neededBytesForOffsets(.Tys, .MachineSizes) => 0 +rule #neededBytesForOffsets(TY TYS, OFFSET OFFSETS) + => maxInt(#msBytes(OFFSET) +Int #elemSize(lookupTy(TY)), #neededBytesForOffsets(TYS, OFFSETS)) +// Any remaining pattern indicates a length mismatch between types and offsets. +rule #neededBytesForOffsets(_, _) => -1 [owise] + +// Decode each field at its byte offset and return values in declaration order. +syntax List ::= #decodeStructFieldsWithOffsets ( Bytes , Tys , MachineSizes ) [function, total] +rule #decodeStructFieldsWithOffsets(_, .Tys, _OFFSETS) => .List +rule #decodeStructFieldsWithOffsets(_, _TYS, .MachineSizes) => .List [owise] +rule #decodeStructFieldsWithOffsets(BYTES, TY TYS, OFFSET OFFSETS) + => ListItem( + #decodeValue( + substrBytes(BYTES, #msBytes(OFFSET), #msBytes(OFFSET) +Int #elemSize(lookupTy(TY))), + lookupTy(TY) + ) + ) + #decodeStructFieldsWithOffsets(BYTES, TYS, OFFSETS) + requires lengthBytes(BYTES) >=Int (#msBytes(OFFSET) +Int #elemSize(lookupTy(TY))) + [preserves-definedness] +``` + ### Error marker (becomes thunk) for other (unimplemented) cases All unimplemented cases will become thunks by way of this default rule: @@ -84,20 +145,33 @@ All unimplemented cases will become thunks by way of this default rule: ```k // TODO: this function should go into the rt/types.md module - syntax Int ::= #elemSize ( TypeInfo ) [function] + syntax Int ::= #elemSize ( TypeInfo ) [function, total] ``` Known element sizes for common types: ```k + // ---- Primitive types ---- rule #elemSize(typeInfoPrimitiveType(primTypeBool)) => 1 + // Rust `char` is a 32-bit Unicode scalar value + rule #elemSize(typeInfoPrimitiveType(primTypeChar)) => 4 rule #elemSize(TYPEINFO) => #bitWidth(#intTypeOf(TYPEINFO)) /Int 8 requires #isIntType(TYPEINFO) - + // Floating-point sizes + rule #elemSize(typeInfoPrimitiveType(primTypeFloat(floatTyF16))) => 2 + rule #elemSize(typeInfoPrimitiveType(primTypeFloat(floatTyF32))) => 4 + rule #elemSize(typeInfoPrimitiveType(primTypeFloat(floatTyF64))) => 8 + rule #elemSize(typeInfoPrimitiveType(primTypeFloat(floatTyF128))) => 16 + // `str` is unsized; size only known with metadata (e.g., in fat pointers) + rule #elemSize(typeInfoPrimitiveType(primTypeStr)) => 0 + + // ---- Arrays and slices ---- rule #elemSize(typeInfoArrayType(ELEM_TY, someTyConst(tyConst(LEN, _)))) => #elemSize(lookupTy(ELEM_TY)) *Int readTyConstInt(LEN) + // Slice `[T]` has dynamic size; plain value is unsized + rule #elemSize(typeInfoArrayType(_ELEM_TY, noTyConst)) => 0 - // thin and fat pointers + // ---- thin and fat pointers ---- rule #elemSize(typeInfoRefType(TY)) => #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) requires dynamicSize(1) ==K #metadataSize(TY) rule #elemSize(typeInfoRefType(_)) => 2 *Int #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) @@ -107,10 +181,24 @@ Known element sizes for common types: rule #elemSize(typeInfoPtrType(_)) => 2 *Int #elemSize(typeInfoPrimitiveType(primTypeUint(uintTyUsize))) [owise] + // ---- Tuples ---- + // Without layout, approximate as sum of element sizes (ignores padding). + rule #elemSize(typeInfoTupleType(.Tys)) => 0 + rule #elemSize(typeInfoTupleType(TY TYS)) + => #elemSize(lookupTy(TY)) +Int #elemSize(typeInfoTupleType(TYS)) + + // ---- Structs and Enums with layout ---- + rule #elemSize(typeInfoStructType(_, _, _, someLayoutShape(layoutShape(_, _, _, _, SIZE)))) => #msBytes(SIZE) + rule #elemSize(typeInfoEnumType(_, _, _, _, someLayoutShape(layoutShape(_, _, _, _, SIZE)))) => #msBytes(SIZE) + + // ---- Function item types ---- + // Function items are zero-sized; function pointers are handled by PtrType + rule #elemSize(typeInfoFunType(_)) => 0 + rule #elemSize(typeInfoVoidType) => 0 - // FIXME can only use size from layout here. Requires adding layout first. - // Enum, Struct, Tuple, + // Fallback to keep the function total for any remaining cases + rule #elemSize(_) => 0 [owise] rule 0 <=Int #elemSize(_) => true [simplification, preserves-definedness] ``` diff --git a/kmir/src/kmir/kdist/mir-semantics/ty.md b/kmir/src/kmir/kdist/mir-semantics/ty.md index dd00edb67..9defdbb6e 100644 --- a/kmir/src/kmir/kdist/mir-semantics/ty.md +++ b/kmir/src/kmir/kdist/mir-semantics/ty.md @@ -265,7 +265,11 @@ syntax ExistentialPredicateBinders ::= List {ExistentialPredicateBinder, ""} , discriminants: Discriminants , fields: Tyss , layout: MaybeLayoutShape) [symbol(TypeInfo::EnumType) , group(mir-enum---name--adt-def--discriminants--fields--layout)] - | typeInfoStructType(MIRString, AdtDef, Tys) [symbol(TypeInfo::StructType) , group(mir-enum---name--adt-def--fields)] + | typeInfoStructType( + name: MIRString + , adtDef: AdtDef + , fields: Tys + , layout: MaybeLayoutShape) [symbol(TypeInfo::StructType) , group(mir-enum---name--adt-def--fields--layout)] | typeInfoUnionType(MIRString, AdtDef) [symbol(TypeInfo::UnionType) , group(mir-enum---name--adt-def)] | typeInfoArrayType(Ty, MaybeTyConst) [symbol(TypeInfo::ArrayType) , group(mir-enum---elem-type--size)] | typeInfoPtrType(Ty) [symbol(TypeInfo::PtrType) , group(mir-enum---pointee-type)] diff --git a/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs new file mode 100644 index 000000000..0b698676a --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs @@ -0,0 +1,24 @@ +#![allow(dead_code)] + +#[derive(Copy, Clone)] +pub struct Pubkey(pub [u8; 32]); + +const KEY: Pubkey = Pubkey([ + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, +]); + +#[inline(never)] +fn use_inner(arr: &[u8; 32]) -> usize { + // Touch the array so MIR keeps the projection + if arr[0] == 0 { 32 } else { 0 } +} + +fn main() { + let pk = KEY; // forces constant decoding of StructType(newtype) + let len = use_inner(&pk.0); // field projection .0; needs StructType decode to Aggregate + core::hint::black_box(len); +} + diff --git a/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.smir.json b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.smir.json new file mode 100644 index 000000000..d641b5e87 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.smir.json @@ -0,0 +1,3406 @@ +{ + "name": "newtype_pubkey", + "crate_id": 5420632119300128232, + "allocs": [], + "functions": [ + [ + 0, + { + "NormalSym": "_ZN3std2rt19lang_start_internal17h035df9ff6960926aE" + } + ], + [ + 13, + { + "NormalSym": "_ZN3std3sys9backtrace28__rust_begin_short_backtrace17h217ebc8958a2e0f7E" + } + ], + [ + 14, + { + "NormalSym": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17he9bdea485b0b8eefE" + } + ], + [ + 19, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17h0314312c7330f16dE" + } + ], + [ + 20, + { + "IntrinsicSym": "black_box" + } + ], + [ + 21, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17h3fd1a6eedf751fe2E" + } + ], + [ + 23, + { + "NormalSym": "_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h51527ef46083cf19E" + } + ], + [ + 25, + { + "IntrinsicSym": "black_box" + } + ], + [ + 29, + { + "NormalSym": "_ZN14newtype_pubkey9use_inner17h230c2bffb6728494E" + } + ], + [ + 32, + { + "NormalSym": "_ZN4core4hint9black_box17hbacba317dc8c2f63E" + } + ], + [ + 33, + { + "NoOpSym": "" + } + ] + ], + "uneval_consts": [], + "items": [ + { + "symbol_name": "_ZN14newtype_pubkey4main17h8f945f52f3914dbdE", + "mono_item_kind": { + "MonoItemFn": { + "name": "main", + "id": 8, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 1, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 65, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + }, + "ty": 30, + "id": 13 + } + } + } + } + ] + }, + "span": 65 + }, + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [ + { + "Field": [ + 0, + 31 + ] + } + ] + } + ] + } + ] + }, + "span": 66 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 63, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 29, + "id": 12 + } + } + }, + "args": [ + { + "Copy": { + "local": 3, + "projection": [] + } + } + ], + "destination": { + "local": 2, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 64 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 67, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 32, + "id": 14 + } + } + }, + "args": [ + { + "Copy": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 4, + "projection": [] + }, + "target": 2, + "unwind": "Continue" + } + }, + "span": 68 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 69 + } + } + ], + "locals": [ + { + "ty": 1, + "span": 70, + "mutability": "Mut" + }, + { + "ty": 30, + "span": 71, + "mutability": "Not" + }, + { + "ty": 26, + "span": 72, + "mutability": "Not" + }, + { + "ty": 27, + "span": 66, + "mutability": "Not" + }, + { + "ty": 26, + "span": 68, + "mutability": "Not" + } + ], + "arg_count": 0, + "var_debug_info": [ + { + "name": "pk", + "source_info": { + "span": 71, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "len", + "source_info": { + "span": 72, + "scope": 2 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": null + } + ], + "spread_arg": null, + "span": 73 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN14newtype_pubkey9use_inner17h230c2bffb6728494E", + "mono_item_kind": { + "MonoItemFn": { + "name": "use_inner", + "id": 7, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 54, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 26, + "id": 10 + } + } + } + } + ] + }, + "span": 54 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 32, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 26, + "id": 11 + } + } + } + } + ] + }, + "span": 53 + }, + { + "kind": { + "Assign": [ + { + "local": 5, + "projection": [] + }, + { + "BinaryOp": [ + "Lt", + { + "Copy": { + "local": 3, + "projection": [] + } + }, + { + "Copy": { + "local": 4, + "projection": [] + } + } + ] + } + ] + }, + "span": 53 + } + ], + "terminator": { + "kind": { + "Assert": { + "cond": { + "Move": { + "local": 5, + "projection": [] + } + }, + "expected": true, + "msg": { + "BoundsCheck": { + "len": { + "Move": { + "local": 4, + "projection": [] + } + }, + "index": { + "Copy": { + "local": 3, + "projection": [] + } + } + } + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 53 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref", + { + "Index": 3 + } + ] + } + } + } + ] + }, + "span": 53 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 2, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 2 + ] + ], + "otherwise": 3 + } + } + }, + "span": 55 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 57, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 26, + "id": 11 + } + } + } + } + ] + }, + "span": 57 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 4 + } + }, + "span": 56 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 58, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 26, + "id": 10 + } + } + } + } + ] + }, + "span": 58 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 4 + } + }, + "span": 56 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 59 + } + } + ], + "locals": [ + { + "ty": 26, + "span": 60, + "mutability": "Mut" + }, + { + "ty": 27, + "span": 61, + "mutability": "Not" + }, + { + "ty": 9, + "span": 53, + "mutability": "Mut" + }, + { + "ty": 26, + "span": 54, + "mutability": "Not" + }, + { + "ty": 26, + "span": 53, + "mutability": "Mut" + }, + { + "ty": 28, + "span": 53, + "mutability": "Mut" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "arr", + "source_info": { + "span": 61, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 62 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std2rt10lang_start17h40b075be88868699E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>", + "id": 0, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 5 + }, + "span": 1 + }, + { + "kind": { + "StorageLive": 6 + }, + "span": 2 + }, + { + "kind": { + "StorageLive": 8 + }, + "span": 3 + }, + { + "kind": { + "Assign": [ + { + "local": 8, + "projection": [] + }, + { + "Aggregate": [ + { + "Closure": [ + 1, + [ + { + "Type": 1 + }, + { + "Type": 2 + }, + { + "Type": 3 + }, + { + "Type": 4 + } + ] + ] + }, + [ + { + "Copy": { + "local": 1, + "projection": [] + } + } + ] + ] + } + ] + }, + "span": 3 + }, + { + "kind": { + "Assign": [ + { + "local": 7, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 8, + "projection": [] + } + ] + } + ] + }, + "span": 2 + }, + { + "kind": { + "Assign": [ + { + "local": 6, + "projection": [] + }, + { + "Cast": [ + { + "PointerCoercion": "Unsize" + }, + { + "Copy": { + "local": 7, + "projection": [] + } + }, + 5 + ] + } + ] + }, + "span": 2 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 0, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 0, + "id": 0 + } + } + }, + "args": [ + { + "Move": { + "local": 6, + "projection": [] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + }, + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 4, + "projection": [] + } + } + ], + "destination": { + "local": 5, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 1 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 6 + }, + "span": 5 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 5, + "projection": [ + { + "Downcast": 0 + }, + { + "Field": [ + 0, + 6 + ] + } + ] + } + } + } + ] + }, + "span": 6 + }, + { + "kind": { + "StorageDead": 8 + }, + "span": 7 + }, + { + "kind": { + "StorageDead": 5 + }, + "span": 7 + } + ], + "terminator": { + "kind": "Return", + "span": 4 + } + } + ], + "locals": [ + { + "ty": 6, + "span": 8, + "mutability": "Mut" + }, + { + "ty": 7, + "span": 9, + "mutability": "Not" + }, + { + "ty": 6, + "span": 10, + "mutability": "Not" + }, + { + "ty": 8, + "span": 11, + "mutability": "Not" + }, + { + "ty": 9, + "span": 12, + "mutability": "Not" + }, + { + "ty": 10, + "span": 1, + "mutability": "Mut" + }, + { + "ty": 5, + "span": 2, + "mutability": "Mut" + }, + { + "ty": 11, + "span": 2, + "mutability": "Not" + }, + { + "ty": 12, + "span": 3, + "mutability": "Not" + } + ], + "arg_count": 4, + "var_debug_info": [ + { + "name": "main", + "source_info": { + "span": 9, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "argc", + "source_info": { + "span": 10, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "argv", + "source_info": { + "span": 11, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 3, + "projection": [] + } + }, + "argument_index": 3 + }, + { + "name": "sigpipe", + "source_info": { + "span": 12, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 4, + "projection": [] + } + }, + "argument_index": 4 + }, + { + "name": "v", + "source_info": { + "span": 6, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 0, + "projection": [] + } + }, + "argument_index": null + } + ], + "spread_arg": null, + "span": 13 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h51527ef46083cf19E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>::{closure#0}", + "id": 1, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 2 + }, + "span": 16 + }, + { + "kind": { + "StorageLive": 3 + }, + "span": 15 + }, + { + "kind": { + "StorageLive": 4 + }, + "span": 17 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 0, + 7 + ] + } + ] + } + } + } + ] + }, + "span": 17 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 14, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 13, + "id": 1 + } + } + }, + "args": [ + { + "Move": { + "local": 4, + "projection": [] + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 15 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 4 + }, + "span": 19 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 18, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 14, + "id": 2 + } + } + }, + "args": [ + { + "Move": { + "local": 3, + "projection": [] + } + } + ], + "destination": { + "local": 2, + "projection": [] + }, + "target": 2, + "unwind": "Continue" + } + }, + "span": 16 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 3 + }, + "span": 21 + }, + { + "kind": { + "StorageLive": 5 + }, + "span": 22 + }, + { + "kind": { + "Assign": [ + { + "local": 5, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 2, + "projection": [ + { + "Field": [ + 0, + 15 + ] + } + ] + } + ] + } + ] + }, + "span": 22 + }, + { + "kind": { + "StorageLive": 6 + }, + "span": 23 + }, + { + "kind": { + "Assign": [ + { + "local": 6, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [ + { + "Field": [ + 0, + 15 + ] + }, + { + "Field": [ + 0, + 9 + ] + } + ] + } + } + } + ] + }, + "span": 23 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Cast": [ + "IntToInt", + { + "Move": { + "local": 6, + "projection": [] + } + }, + 16 + ] + } + ] + }, + "span": 24 + }, + { + "kind": { + "StorageDead": 6 + }, + "span": 25 + }, + { + "kind": { + "StorageDead": 5 + }, + "span": 26 + }, + { + "kind": { + "StorageDead": 2 + }, + "span": 27 + } + ], + "terminator": { + "kind": "Return", + "span": 20 + } + } + ], + "locals": [ + { + "ty": 16, + "span": 28, + "mutability": "Mut" + }, + { + "ty": 11, + "span": 3, + "mutability": "Mut" + }, + { + "ty": 17, + "span": 16, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 15, + "mutability": "Mut" + }, + { + "ty": 7, + "span": 17, + "mutability": "Mut" + }, + { + "ty": 18, + "span": 22, + "mutability": "Mut" + }, + { + "ty": 9, + "span": 23, + "mutability": "Mut" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "main", + "source_info": { + "span": 9, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 0, + 7 + ] + } + ] + } + }, + "argument_index": null + }, + { + "name": "self", + "source_info": { + "span": 29, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "self", + "source_info": { + "span": 30, + "scope": 2 + }, + "composite": null, + "value": { + "Place": { + "local": 5, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 3 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std3sys9backtrace28__rust_begin_short_backtrace17h217ebc8958a2e0f7E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::sys::backtrace::__rust_begin_short_backtrace::", + "id": 2, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 31, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 19, + "id": 3 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [] + } + }, + { + "Constant": { + "span": 32, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 1, + "id": 4 + } + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 33 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 34, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 20, + "id": 5 + } + } + }, + "args": [ + { + "Constant": { + "span": 32, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 1, + "id": 4 + } + } + } + ], + "destination": { + "local": 2, + "projection": [] + }, + "target": 2, + "unwind": "Unreachable" + } + }, + "span": 35 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 36 + } + } + ], + "locals": [ + { + "ty": 1, + "span": 37, + "mutability": "Mut" + }, + { + "ty": 7, + "span": 38, + "mutability": "Not" + }, + { + "ty": 1, + "span": 39, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "f", + "source_info": { + "span": 38, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "result", + "source_info": { + "span": 40, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 0, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "dummy", + "source_info": { + "span": 41, + "scope": 2 + }, + "composite": null, + "value": { + "Const": { + "span": 32, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 1, + "id": 4 + } + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 42 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h0ce30afb4ab9b6e9E", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 3, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 43, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 21, + "id": 6 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [ + "Deref" + ] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 43 + } + } + ], + "locals": [ + { + "ty": 16, + "span": 43, + "mutability": "Mut" + }, + { + "ty": 22, + "span": 43, + "mutability": "Not" + }, + { + "ty": 1, + "span": 43, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 43 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce9call_once17h0314312c7330f16dE", + "mono_item_kind": { + "MonoItemFn": { + "name": ">::call_once", + "id": 3, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Move": { + "local": 1, + "projection": [] + } + }, + "args": [], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 43 + } + } + ], + "locals": [ + { + "ty": 1, + "span": 43, + "mutability": "Mut" + }, + { + "ty": 7, + "span": 43, + "mutability": "Not" + }, + { + "ty": 1, + "span": 43, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 43 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce9call_once17h3fd1a6eedf751fe2E", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 3, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + { + "Mut": { + "kind": "Default" + } + }, + { + "local": 1, + "projection": [] + } + ] + } + ] + }, + "span": 43 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 43, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 23, + "id": 7 + } + } + }, + "args": [ + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": { + "Cleanup": 3 + } + } + }, + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Drop": { + "place": { + "local": 1, + "projection": [] + }, + "target": 2, + "unwind": "Continue" + } + }, + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Drop": { + "place": { + "local": 1, + "projection": [] + }, + "target": 4, + "unwind": "Terminate" + } + }, + "span": 43 + } + }, + { + "statements": [], + "terminator": { + "kind": "Resume", + "span": 43 + } + } + ], + "locals": [ + { + "ty": 16, + "span": 43, + "mutability": "Mut" + }, + { + "ty": 12, + "span": 43, + "mutability": "Not" + }, + { + "ty": 1, + "span": 43, + "mutability": "Not" + }, + { + "ty": 24, + "span": 43, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 43 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hcda3c7cfa27e5721E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::ptr::drop_in_place::<{closure@std::rt::lang_start<()>::{closure#0}}>", + "id": 4, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 44 + } + } + ], + "locals": [ + { + "ty": 1, + "span": 44, + "mutability": "Mut" + }, + { + "ty": 22, + "span": 44, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [], + "spread_arg": null, + "span": 44 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core4hint9black_box17hbacba317dc8c2f63E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::hint::black_box::", + "id": 5, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 34, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 25, + "id": 8 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Unreachable" + } + }, + "span": 35 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 45 + } + } + ], + "locals": [ + { + "ty": 26, + "span": 46, + "mutability": "Mut" + }, + { + "ty": 26, + "span": 41, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "dummy", + "source_info": { + "span": 41, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 47 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17he9bdea485b0b8eefE", + "mono_item_kind": { + "MonoItemFn": { + "name": "<() as std::process::Termination>::report", + "id": 6, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 49, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 17, + "id": 9 + } + } + } + } + ] + }, + "span": 49 + } + ], + "terminator": { + "kind": "Return", + "span": 48 + } + } + ], + "locals": [ + { + "ty": 17, + "span": 50, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 51, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 51, + "scope": 0 + }, + "composite": null, + "value": { + "Const": { + "span": 32, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 1, + "id": 4 + } + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 52 + } + } + }, + "details": null + } + ], + "types": [ + [ + 1, + { + "TupleType": { + "types": [], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 0 + } + } + } + } + ], + [ + 5, + { + "RefType": { + "pointee_type": 34, + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + }, + { + "num_bits": 64 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + }, + { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + } + } + } + ], + [ + 6, + { + "PrimitiveType": { + "Int": "Isize" + } + } + ], + [ + 8, + { + "PtrType": { + "pointee_type": 35, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 9, + { + "PrimitiveType": { + "Uint": "U8" + } + } + ], + [ + 10, + { + "EnumType": { + "name": "std::result::Result", + "adt_def": 23, + "discriminants": [ + 0, + 1 + ], + "fields": [ + [ + 6 + ], + [ + 36 + ] + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": true + } + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 11, + { + "RefType": { + "pointee_type": 12, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 15, + { + "StructType": { + "name": "std::sys::pal::unix::process::process_common::ExitCode", + "adt_def": 12, + "fields": [ + 9 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I8", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 255 + } + } + } + }, + "abi_align": 1, + "size": { + "num_bits": 8 + } + } + } + } + ], + [ + 16, + { + "PrimitiveType": { + "Int": "I32" + } + } + ], + [ + 17, + { + "StructType": { + "name": "std::process::ExitCode", + "adt_def": 10, + "fields": [ + 15 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I8", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 255 + } + } + } + }, + "abi_align": 1, + "size": { + "num_bits": 8 + } + } + } + } + ], + [ + 18, + { + "RefType": { + "pointee_type": 15, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 22, + { + "PtrType": { + "pointee_type": 12, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 24, + { + "RefType": { + "pointee_type": 12, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 26, + { + "PrimitiveType": { + "Uint": "Usize" + } + } + ], + [ + 27, + { + "RefType": { + "pointee_type": 31, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 28, + { + "PrimitiveType": "Bool" + } + ], + [ + 30, + { + "StructType": { + "name": "Pubkey", + "adt_def": 14, + "fields": [ + 31 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 256 + } + } + } + } + ], + [ + 31, + { + "ArrayType": { + "elem_type": 9, + "size": { + "kind": { + "Value": [ + 26, + { + "bytes": [ + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 8, + "mutability": "Mut" + } + ] + }, + "id": 0 + }, + "layout": { + "fields": { + "Array": { + "stride": { + "num_bits": 8 + }, + "count": 32 + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 256 + } + } + } + } + ], + [ + 35, + { + "PtrType": { + "pointee_type": 9, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 36, + "VoidType" + ] + ], + "spans": [ + [ + 0, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 194, + 36 + ] + ], + [ + 1, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 199, + 6 + ] + ], + [ + 2, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 9, + 195, + 93 + ] + ], + [ + 3, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 10, + 195, + 93 + ] + ], + [ + 4, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 201, + 2, + 201, + 2 + ] + ], + [ + 5, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 5, + 199, + 6 + ] + ], + [ + 6, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 12, + 194, + 13 + ] + ], + [ + 7, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 6, + 199, + 7 + ] + ], + [ + 9, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 189, + 5, + 189, + 9 + ] + ], + [ + 10, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 190, + 5, + 190, + 9 + ] + ], + [ + 11, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 191, + 5, + 191, + 9 + ] + ], + [ + 12, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 192, + 5, + 192, + 12 + ] + ], + [ + 13, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 188, + 1, + 201, + 2 + ] + ], + [ + 14, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 69 + ] + ], + [ + 15, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 75 + ] + ], + [ + 16, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 84 + ] + ], + [ + 17, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 70, + 195, + 74 + ] + ], + [ + 18, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 76, + 195, + 82 + ] + ], + [ + 19, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 74, + 195, + 75 + ] + ], + [ + 20, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 93, + 195, + 93 + ] + ], + [ + 21, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 83, + 195, + 84 + ] + ], + [ + 22, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 9, + 2053, + 15 + ] + ], + [ + 23, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 15 + ] + ], + [ + 24, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 22 + ] + ], + [ + 25, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 21, + 636, + 22 + ] + ], + [ + 26, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 23, + 2053, + 24 + ] + ], + [ + 27, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 92, + 195, + 93 + ] + ], + [ + 29, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2052, + 19, + 2052, + 23 + ] + ], + [ + 30, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 635, + 19, + 635, + 24 + ] + ], + [ + 31, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 19 + ] + ], + [ + 32, + [ + "no-location", + 0, + 0, + 0, + 0 + ] + ], + [ + 33, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 21 + ] + ], + [ + 34, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 33 + ] + ], + [ + 35, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 40 + ] + ], + [ + 36, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 160, + 2, + 160, + 2 + ] + ], + [ + 38, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 43, + 150, + 44 + ] + ], + [ + 40, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 9, + 154, + 15 + ] + ], + [ + 41, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 388, + 27, + 388, + 32 + ] + ], + [ + 42, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 1, + 160, + 2 + ] + ], + [ + 43, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs", + 250, + 5, + 250, + 71 + ] + ], + [ + 44, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs", + 521, + 1, + 521, + 56 + ] + ], + [ + 45, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 390, + 2, + 390, + 2 + ] + ], + [ + 47, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 388, + 1, + 390, + 2 + ] + ], + [ + 48, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2424, + 6, + 2424, + 6 + ] + ], + [ + 49, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2423, + 9, + 2423, + 26 + ] + ], + [ + 51, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 15, + 2422, + 19 + ] + ], + [ + 52, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 5, + 2424, + 6 + ] + ], + [ + 53, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 8, + 16, + 14 + ] + ], + [ + 54, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 12, + 16, + 13 + ] + ], + [ + 55, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 8, + 16, + 19 + ] + ], + [ + 56, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 5, + 16, + 37 + ] + ], + [ + 57, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 22, + 16, + 24 + ] + ], + [ + 58, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 16, + 34, + 16, + 35 + ] + ], + [ + 59, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 17, + 2, + 17, + 2 + ] + ], + [ + 61, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 14, + 14, + 14, + 17 + ] + ], + [ + 62, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 14, + 1, + 17, + 2 + ] + ], + [ + 63, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 21, + 15, + 21, + 24 + ] + ], + [ + 64, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 21, + 15, + 21, + 31 + ] + ], + [ + 65, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 20, + 14, + 20, + 17 + ] + ], + [ + 66, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 21, + 25, + 21, + 30 + ] + ], + [ + 67, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 22, + 5, + 22, + 26 + ] + ], + [ + 68, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 22, + 5, + 22, + 31 + ] + ], + [ + 69, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 23, + 2, + 23, + 2 + ] + ], + [ + 71, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 20, + 9, + 20, + 11 + ] + ], + [ + 72, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 21, + 9, + 21, + 12 + ] + ], + [ + 73, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.rs", + 19, + 1, + 23, + 2 + ] + ] + ], + "debug": null, + "machine": { + "endian": "Little", + "pointer_width": { + "num_bits": 64 + } + } +} diff --git a/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.state b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.state new file mode 100644 index 000000000..ac4b58c68 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/newtype-pubkey/newtype-pubkey.state @@ -0,0 +1,71 @@ + + + #EndProgram ~> .K + + + noReturn + + + ty ( -1 ) + + + + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 1 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 65 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" , provenance: provenanceMap (... ptrs: .ProvenanceMapEntries ) , align: align ( 1 ) , mutability: mutabilityNot ) ) , ty: ty ( 30 ) , id: mirConstId ( 13 ) ) ) ) ) ) , span: span ( 65 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 3 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 31 ) ) .ProjectionElems ) ) ) , span: span ( 66 ) ) .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 63 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 29 ) , id: mirConstId ( 12 ) ) ) ) , args: operandCopy ( place (... local: local ( 3 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 2 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 1 ) ) , unwind: unwindActionContinue ) , span: span ( 64 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 67 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 32 ) , id: mirConstId ( 14 ) ) ) ) , args: operandCopy ( place (... local: local ( 2 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 4 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 2 ) ) , unwind: unwindActionContinue ) , span: span ( 68 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindReturn , span: span ( 69 ) ) ) ) + + + ty ( -1 ) + + + place (... local: local ( 0 ) , projection: .ProjectionElems ) + + + noBasicBlockIdx + + + unwindActionContinue + + + ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Range ( ListItem ( Integer ( 0 , 8 , false ) ) + ListItem ( Integer ( 1 , 8 , false ) ) + ListItem ( Integer ( 2 , 8 , false ) ) + ListItem ( Integer ( 3 , 8 , false ) ) + ListItem ( Integer ( 4 , 8 , false ) ) + ListItem ( Integer ( 5 , 8 , false ) ) + ListItem ( Integer ( 6 , 8 , false ) ) + ListItem ( Integer ( 7 , 8 , false ) ) + ListItem ( Integer ( 8 , 8 , false ) ) + ListItem ( Integer ( 9 , 8 , false ) ) + ListItem ( Integer ( 10 , 8 , false ) ) + ListItem ( Integer ( 11 , 8 , false ) ) + ListItem ( Integer ( 12 , 8 , false ) ) + ListItem ( Integer ( 13 , 8 , false ) ) + ListItem ( Integer ( 14 , 8 , false ) ) + ListItem ( Integer ( 15 , 8 , false ) ) + ListItem ( Integer ( 16 , 8 , false ) ) + ListItem ( Integer ( 17 , 8 , false ) ) + ListItem ( Integer ( 18 , 8 , false ) ) + ListItem ( Integer ( 19 , 8 , false ) ) + ListItem ( Integer ( 20 , 8 , false ) ) + ListItem ( Integer ( 21 , 8 , false ) ) + ListItem ( Integer ( 22 , 8 , false ) ) + ListItem ( Integer ( 23 , 8 , false ) ) + ListItem ( Integer ( 24 , 8 , false ) ) + ListItem ( Integer ( 25 , 8 , false ) ) + ListItem ( Integer ( 26 , 8 , false ) ) + ListItem ( Integer ( 27 , 8 , false ) ) + ListItem ( Integer ( 28 , 8 , false ) ) + ListItem ( Integer ( 29 , 8 , false ) ) + ListItem ( Integer ( 30 , 8 , false ) ) + ListItem ( Integer ( 31 , 8 , false ) ) ) ) ) , ty ( 30 ) , mutabilityNot ) ) + ListItem ( typedValue ( Integer ( 32 , 64 , false ) , ty ( 26 ) , mutabilityNot ) ) + ListItem ( typedValue ( Reference ( 0 , place (... local: local ( 1 ) , projection: projectionElemField ( fieldIdx ( 0 ) , ty ( 31 ) ) .ProjectionElems ) , mutabilityNot , metadata ( staticSize ( 32 ) , 0 , noMetadataSize ) ) , ty ( 27 ) , mutabilityNot ) ) + ListItem ( typedValue ( Integer ( 32 , 64 , false ) , ty ( 26 ) , mutabilityNot ) ) + + + + ListItem ( StackFrame ( ty ( -1 ) , place (... local: local ( -1 ) , projection: .ProjectionElems ) , noBasicBlockIdx , unwindActionUnreachable , .List ) ) + + \ No newline at end of file diff --git a/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs new file mode 100644 index 000000000..00d04c5e3 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs @@ -0,0 +1,19 @@ +#![allow(dead_code)] + +// Exercise decoding of a struct whose fields are not stored in declaration order. +// RangeInclusive is known to have such a layout on some platforms. + +use std::ops::RangeInclusive; + +// Force a multi-field StructType constant so decoding happens at runtime. +// Use RangeInclusive::new in a const context to avoid evaluation at run time. +const R: RangeInclusive = RangeInclusive::new(0, 31); + +fn main() { + // Use the constant so MIR emits a Constant->Allocated for a StructType with 2 fields + let r = R; + // Compute a boolean via public API that depends on correct internal layout decoding. + // If decoding is wrong (e.g., ignoring non-ordered offsets), this expression can differ. + let ok = r.contains(&0) && r.contains(&31) && !r.contains(&32); + assert!(ok); +} diff --git a/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.smir.json b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.smir.json new file mode 100644 index 000000000..e54cef597 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.smir.json @@ -0,0 +1,7020 @@ +{ + "name": "struct_multi", + "crate_id": 6604885106027647559, + "allocs": [ + { + "alloc_id": 0, + "ty": 0, + "global_alloc": { + "Memory": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + }, + { + "alloc_id": 1, + "ty": 0, + "global_alloc": { + "Memory": { + "bytes": [ + 31 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + }, + { + "alloc_id": 2, + "ty": 0, + "global_alloc": { + "Memory": { + "bytes": [ + 32 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + }, + { + "alloc_id": 4, + "ty": 41, + "global_alloc": { + "Memory": { + "bytes": [ + 97, + 115, + 115, + 101, + 114, + 116, + 105, + 111, + 110, + 32, + 102, + 97, + 105, + 108, + 101, + 100, + 58, + 32, + 111, + 107 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + } + ], + "functions": [ + [ + 5, + { + "NormalSym": "_ZN3std2rt19lang_start_internal17h035df9ff6960926aE" + } + ], + [ + 17, + { + "NormalSym": "_ZN3std3sys9backtrace28__rust_begin_short_backtrace17h1208d731e72b93c5E" + } + ], + [ + 18, + { + "NormalSym": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17h314067c40d672c7eE" + } + ], + [ + 23, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17h9b52994615ddc450E" + } + ], + [ + 24, + { + "IntrinsicSym": "black_box" + } + ], + [ + 25, + { + "NormalSym": "_ZN100_$LT$core..ops..range..RangeInclusive$LT$T$GT$$u20$as$u20$core..ops..range..RangeBounds$LT$T$GT$$GT$11start_bound17h5213ada011830b1fE" + } + ], + [ + 26, + { + "NormalSym": "_ZN4core3cmp5impls54_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u8$GT$2lt17h625e7951e3bd689bE" + } + ], + [ + 27, + { + "NormalSym": "_ZN4core3cmp5impls54_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u8$GT$2le17hf970a823e2a15192E" + } + ], + [ + 28, + { + "NormalSym": "_ZN100_$LT$core..ops..range..RangeInclusive$LT$T$GT$$u20$as$u20$core..ops..range..RangeBounds$LT$T$GT$$GT$9end_bound17h03e61960c3c3acebE" + } + ], + [ + 30, + { + "NormalSym": "_ZN4core3ops5range11RangeBounds8contains17h0b953d8277a33516E" + } + ], + [ + 31, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17h1a38fb0400bcebc9E" + } + ], + [ + 33, + { + "NormalSym": "_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17ha16fa5eebd646573E" + } + ], + [ + 35, + { + "NormalSym": "_ZN4core3ops5range25RangeInclusive$LT$Idx$GT$8contains17h9cbf222eb05bc29eE" + } + ], + [ + 37, + { + "NormalSym": "_ZN4core9panicking5panic17h37379bf3ce79a0d7E" + } + ], + [ + 44, + { + "NoOpSym": "" + } + ] + ], + "uneval_consts": [], + "items": [ + { + "symbol_name": "_ZN100_$LT$core..ops..range..RangeInclusive$LT$T$GT$$u20$as$u20$core..ops..range..RangeBounds$LT$T$GT$$GT$11start_bound17h5213ada011830b1fE", + "mono_item_kind": { + "MonoItemFn": { + "name": " as std::ops::RangeBounds>::start_bound", + "id": 0, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 0, + 0 + ] + } + ] + } + ] + } + ] + }, + "span": 1 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Aggregate": [ + { + "Adt": [ + 1, + 0, + [ + { + "Type": 1 + } + ], + null, + null + ] + }, + [ + { + "Copy": { + "local": 2, + "projection": [] + } + } + ] + ] + } + ] + }, + "span": 2 + } + ], + "terminator": { + "kind": "Return", + "span": 0 + } + } + ], + "locals": [ + { + "ty": 2, + "span": 3, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 4, + "mutability": "Not" + }, + { + "ty": 1, + "span": 1, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 4, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 5 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN100_$LT$core..ops..range..RangeInclusive$LT$T$GT$$u20$as$u20$core..ops..range..RangeBounds$LT$T$GT$$GT$9end_bound17h03e61960c3c3acebE", + "mono_item_kind": { + "MonoItemFn": { + "name": " as std::ops::RangeBounds>::end_bound", + "id": 2, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 2 + }, + "span": 6 + }, + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 2, + 4 + ] + } + ] + } + } + } + ] + }, + "span": 6 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 2, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 2 + ] + ], + "otherwise": 1 + } + } + }, + "span": 6 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 1, + 0 + ] + } + ] + } + ] + } + ] + }, + "span": 8 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Aggregate": [ + { + "Adt": [ + 1, + 1, + [ + { + "Type": 1 + } + ], + null, + null + ] + }, + [ + { + "Copy": { + "local": 3, + "projection": [] + } + } + ] + ] + } + ] + }, + "span": 9 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 3 + } + }, + "span": 7 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 1, + 0 + ] + } + ] + } + ] + } + ] + }, + "span": 10 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Aggregate": [ + { + "Adt": [ + 1, + 0, + [ + { + "Type": 1 + } + ], + null, + null + ] + }, + [ + { + "Copy": { + "local": 4, + "projection": [] + } + } + ] + ] + } + ] + }, + "span": 11 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 3 + } + }, + "span": 7 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 2 + }, + "span": 13 + } + ], + "terminator": { + "kind": "Return", + "span": 12 + } + } + ], + "locals": [ + { + "ty": 2, + "span": 14, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 15, + "mutability": "Not" + }, + { + "ty": 4, + "span": 6, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 8, + "mutability": "Not" + }, + { + "ty": 1, + "span": 10, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 15, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 16 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN12struct_multi4main17hc99c4ca853516311E", + "mono_item_kind": { + "MonoItemFn": { + "name": "main", + "id": 13, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 1, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 137, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 31 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + }, + "ty": 36, + "id": 17 + } + } + } + } + ] + }, + "span": 137 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [] + } + ] + } + ] + }, + "span": 138 + }, + { + "kind": { + "Assign": [ + { + "local": 5, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 139, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 0 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 1, + "id": 18 + } + } + } + } + ] + }, + "span": 139 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 135, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 35, + "id": 16 + } + } + }, + "args": [ + { + "Move": { + "local": 4, + "projection": [] + } + }, + { + "Copy": { + "local": 5, + "projection": [] + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 136 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 3, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 5 + ] + ], + "otherwise": 2 + } + } + }, + "span": 136 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 7, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [] + } + ] + } + ] + }, + "span": 142 + }, + { + "kind": { + "Assign": [ + { + "local": 8, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 143, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 1 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 1, + "id": 19 + } + } + } + } + ] + }, + "span": 143 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 140, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 35, + "id": 16 + } + } + }, + "args": [ + { + "Move": { + "local": 7, + "projection": [] + } + }, + { + "Copy": { + "local": 8, + "projection": [] + } + } + ], + "destination": { + "local": 6, + "projection": [] + }, + "target": 3, + "unwind": "Continue" + } + }, + "span": 141 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 6, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 5 + ] + ], + "otherwise": 4 + } + } + }, + "span": 141 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 10, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 1, + "projection": [] + } + ] + } + ] + }, + "span": 146 + }, + { + "kind": { + "Assign": [ + { + "local": 11, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 147, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 2 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 1, + "id": 20 + } + } + } + } + ] + }, + "span": 147 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 144, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 35, + "id": 16 + } + } + }, + "args": [ + { + "Move": { + "local": 10, + "projection": [] + } + }, + { + "Copy": { + "local": 11, + "projection": [] + } + } + ], + "destination": { + "local": 9, + "projection": [] + }, + "target": 6, + "unwind": "Continue" + } + }, + "span": 145 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 148, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 4, + "id": 10 + } + } + } + } + ] + }, + "span": 148 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 7 + } + }, + "span": 148 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "UnaryOp": [ + "Not", + { + "Move": { + "local": 9, + "projection": [] + } + } + ] + } + ] + }, + "span": 149 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 7 + } + }, + "span": 148 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 12, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [] + } + } + } + ] + }, + "span": 150 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 12, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 8 + ] + ], + "otherwise": 9 + } + } + }, + "span": 150 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 151, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 37, + "id": 21 + } + } + }, + "args": [ + { + "Constant": { + "span": 49, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 3 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 38, + "id": 22 + } + } + } + ], + "destination": { + "local": 13, + "projection": [] + }, + "target": null, + "unwind": "Continue" + } + }, + "span": 151 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 152 + } + } + ], + "locals": [ + { + "ty": 6, + "span": 153, + "mutability": "Mut" + }, + { + "ty": 36, + "span": 154, + "mutability": "Not" + }, + { + "ty": 4, + "span": 155, + "mutability": "Not" + }, + { + "ty": 4, + "span": 136, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 138, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 139, + "mutability": "Not" + }, + { + "ty": 4, + "span": 141, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 142, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 143, + "mutability": "Not" + }, + { + "ty": 4, + "span": 145, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 146, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 147, + "mutability": "Not" + }, + { + "ty": 4, + "span": 150, + "mutability": "Mut" + }, + { + "ty": 39, + "span": 151, + "mutability": "Mut" + } + ], + "arg_count": 0, + "var_debug_info": [ + { + "name": "r", + "source_info": { + "span": 154, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "ok", + "source_info": { + "span": 155, + "scope": 2 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": null + } + ], + "spread_arg": null, + "span": 156 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std2rt10lang_start17h859c8851c3f39cb4E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>", + "id": 3, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 5 + }, + "span": 18 + }, + { + "kind": { + "StorageLive": 6 + }, + "span": 19 + }, + { + "kind": { + "StorageLive": 8 + }, + "span": 20 + }, + { + "kind": { + "Assign": [ + { + "local": 8, + "projection": [] + }, + { + "Aggregate": [ + { + "Closure": [ + 4, + [ + { + "Type": 6 + }, + { + "Type": 7 + }, + { + "Type": 8 + }, + { + "Type": 9 + } + ] + ] + }, + [ + { + "Copy": { + "local": 1, + "projection": [] + } + } + ] + ] + } + ] + }, + "span": 20 + }, + { + "kind": { + "Assign": [ + { + "local": 7, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 8, + "projection": [] + } + ] + } + ] + }, + "span": 19 + }, + { + "kind": { + "Assign": [ + { + "local": 6, + "projection": [] + }, + { + "Cast": [ + { + "PointerCoercion": "Unsize" + }, + { + "Copy": { + "local": 7, + "projection": [] + } + }, + 10 + ] + } + ] + }, + "span": 19 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 17, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 5, + "id": 0 + } + } + }, + "args": [ + { + "Move": { + "local": 6, + "projection": [] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + }, + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 4, + "projection": [] + } + } + ], + "destination": { + "local": 5, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 18 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 6 + }, + "span": 22 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 5, + "projection": [ + { + "Downcast": 0 + }, + { + "Field": [ + 0, + 11 + ] + } + ] + } + } + } + ] + }, + "span": 23 + }, + { + "kind": { + "StorageDead": 8 + }, + "span": 24 + }, + { + "kind": { + "StorageDead": 5 + }, + "span": 24 + } + ], + "terminator": { + "kind": "Return", + "span": 21 + } + } + ], + "locals": [ + { + "ty": 11, + "span": 25, + "mutability": "Mut" + }, + { + "ty": 12, + "span": 26, + "mutability": "Not" + }, + { + "ty": 11, + "span": 27, + "mutability": "Not" + }, + { + "ty": 13, + "span": 28, + "mutability": "Not" + }, + { + "ty": 0, + "span": 29, + "mutability": "Not" + }, + { + "ty": 14, + "span": 18, + "mutability": "Mut" + }, + { + "ty": 10, + "span": 19, + "mutability": "Mut" + }, + { + "ty": 15, + "span": 19, + "mutability": "Not" + }, + { + "ty": 16, + "span": 20, + "mutability": "Not" + } + ], + "arg_count": 4, + "var_debug_info": [ + { + "name": "main", + "source_info": { + "span": 26, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "argc", + "source_info": { + "span": 27, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "argv", + "source_info": { + "span": 28, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 3, + "projection": [] + } + }, + "argument_index": 3 + }, + { + "name": "sigpipe", + "source_info": { + "span": 29, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 4, + "projection": [] + } + }, + "argument_index": 4 + }, + { + "name": "v", + "source_info": { + "span": 23, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 0, + "projection": [] + } + }, + "argument_index": null + } + ], + "spread_arg": null, + "span": 30 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17ha16fa5eebd646573E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>::{closure#0}", + "id": 4, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 2 + }, + "span": 33 + }, + { + "kind": { + "StorageLive": 3 + }, + "span": 32 + }, + { + "kind": { + "StorageLive": 4 + }, + "span": 34 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 0, + 12 + ] + } + ] + } + } + } + ] + }, + "span": 34 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 31, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 17, + "id": 1 + } + } + }, + "args": [ + { + "Move": { + "local": 4, + "projection": [] + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 32 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 4 + }, + "span": 36 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 35, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 18, + "id": 2 + } + } + }, + "args": [ + { + "Move": { + "local": 3, + "projection": [] + } + } + ], + "destination": { + "local": 2, + "projection": [] + }, + "target": 2, + "unwind": "Continue" + } + }, + "span": 33 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 3 + }, + "span": 38 + }, + { + "kind": { + "StorageLive": 5 + }, + "span": 39 + }, + { + "kind": { + "Assign": [ + { + "local": 5, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 2, + "projection": [ + { + "Field": [ + 0, + 19 + ] + } + ] + } + ] + } + ] + }, + "span": 39 + }, + { + "kind": { + "StorageLive": 6 + }, + "span": 40 + }, + { + "kind": { + "Assign": [ + { + "local": 6, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [ + { + "Field": [ + 0, + 19 + ] + }, + { + "Field": [ + 0, + 0 + ] + } + ] + } + } + } + ] + }, + "span": 40 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Cast": [ + "IntToInt", + { + "Move": { + "local": 6, + "projection": [] + } + }, + 20 + ] + } + ] + }, + "span": 41 + }, + { + "kind": { + "StorageDead": 6 + }, + "span": 42 + }, + { + "kind": { + "StorageDead": 5 + }, + "span": 43 + }, + { + "kind": { + "StorageDead": 2 + }, + "span": 44 + } + ], + "terminator": { + "kind": "Return", + "span": 37 + } + } + ], + "locals": [ + { + "ty": 20, + "span": 45, + "mutability": "Mut" + }, + { + "ty": 15, + "span": 20, + "mutability": "Mut" + }, + { + "ty": 21, + "span": 33, + "mutability": "Mut" + }, + { + "ty": 6, + "span": 32, + "mutability": "Mut" + }, + { + "ty": 12, + "span": 34, + "mutability": "Mut" + }, + { + "ty": 22, + "span": 39, + "mutability": "Mut" + }, + { + "ty": 0, + "span": 40, + "mutability": "Mut" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "main", + "source_info": { + "span": 26, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [ + "Deref", + { + "Field": [ + 0, + 12 + ] + } + ] + } + }, + "argument_index": null + }, + { + "name": "self", + "source_info": { + "span": 46, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "self", + "source_info": { + "span": 47, + "scope": 2 + }, + "composite": null, + "value": { + "Place": { + "local": 5, + "projection": [] + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 20 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std3sys9backtrace28__rust_begin_short_backtrace17h1208d731e72b93c5E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::sys::backtrace::__rust_begin_short_backtrace::", + "id": 5, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 48, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 23, + "id": 3 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [] + } + }, + { + "Constant": { + "span": 49, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 6, + "id": 4 + } + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 50 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 51, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 24, + "id": 5 + } + } + }, + "args": [ + { + "Constant": { + "span": 49, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 6, + "id": 4 + } + } + } + ], + "destination": { + "local": 2, + "projection": [] + }, + "target": 2, + "unwind": "Unreachable" + } + }, + "span": 52 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 53 + } + } + ], + "locals": [ + { + "ty": 6, + "span": 54, + "mutability": "Mut" + }, + { + "ty": 12, + "span": 55, + "mutability": "Not" + }, + { + "ty": 6, + "span": 56, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "f", + "source_info": { + "span": 55, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "result", + "source_info": { + "span": 57, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 0, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "dummy", + "source_info": { + "span": 58, + "scope": 2 + }, + "composite": null, + "value": { + "Const": { + "span": 49, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 6, + "id": 4 + } + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 59 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3cmp5impls54_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u8$GT$2le17hf970a823e2a15192E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::cmp::impls::::le", + "id": 6, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 3 + }, + "span": 61 + }, + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref" + ] + } + } + } + ] + }, + "span": 61 + }, + { + "kind": { + "StorageLive": 4 + }, + "span": 62 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [ + "Deref" + ] + } + } + } + ] + }, + "span": 62 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "BinaryOp": [ + "Le", + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 4, + "projection": [] + } + } + ] + } + ] + }, + "span": 63 + }, + { + "kind": { + "StorageDead": 4 + }, + "span": 64 + }, + { + "kind": { + "StorageDead": 3 + }, + "span": 64 + } + ], + "terminator": { + "kind": "Return", + "span": 60 + } + } + ], + "locals": [ + { + "ty": 4, + "span": 65, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 66, + "mutability": "Not" + }, + { + "ty": 1, + "span": 67, + "mutability": "Not" + }, + { + "ty": 0, + "span": 61, + "mutability": "Mut" + }, + { + "ty": 0, + "span": 62, + "mutability": "Mut" + } + ], + "arg_count": 2, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 66, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 67, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + } + ], + "spread_arg": null, + "span": 68 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3cmp5impls54_$LT$impl$u20$core..cmp..PartialOrd$u20$for$u20$u8$GT$2lt17h625e7951e3bd689bE", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::cmp::impls::::lt", + "id": 7, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 3 + }, + "span": 70 + }, + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref" + ] + } + } + } + ] + }, + "span": 70 + }, + { + "kind": { + "StorageLive": 4 + }, + "span": 71 + }, + { + "kind": { + "Assign": [ + { + "local": 4, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [ + "Deref" + ] + } + } + } + ] + }, + "span": 71 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "BinaryOp": [ + "Lt", + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 4, + "projection": [] + } + } + ] + } + ] + }, + "span": 72 + }, + { + "kind": { + "StorageDead": 4 + }, + "span": 73 + }, + { + "kind": { + "StorageDead": 3 + }, + "span": 73 + } + ], + "terminator": { + "kind": "Return", + "span": 69 + } + } + ], + "locals": [ + { + "ty": 4, + "span": 74, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 75, + "mutability": "Not" + }, + { + "ty": 1, + "span": 76, + "mutability": "Not" + }, + { + "ty": 0, + "span": 70, + "mutability": "Mut" + }, + { + "ty": 0, + "span": 71, + "mutability": "Mut" + } + ], + "arg_count": 2, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 75, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 76, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + } + ], + "spread_arg": null, + "span": 77 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops5range11RangeBounds8contains17h0b953d8277a33516E", + "mono_item_kind": { + "MonoItemFn": { + "name": " as std::ops::RangeBounds>::contains::", + "id": 8, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "StorageLive": 3 + }, + "span": 80 + }, + { + "kind": { + "StorageLive": 4 + }, + "span": 79 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 78, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 25, + "id": 6 + } + } + }, + "args": [ + { + "Copy": { + "local": 1, + "projection": [] + } + } + ], + "destination": { + "local": 4, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 79 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 5, + "projection": [] + }, + { + "Discriminant": { + "local": 4, + "projection": [] + } + } + ] + }, + "span": 79 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 5, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 5 + ], + [ + 1, + 4 + ], + [ + 2, + 3 + ] + ], + "otherwise": 2 + } + } + }, + "span": 81 + } + }, + { + "statements": [], + "terminator": { + "kind": "Unreachable", + "span": 49 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Goto": { + "target": 7 + } + }, + "span": 82 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 10, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 4, + "projection": [ + { + "Downcast": 1 + }, + { + "Field": [ + 0, + 1 + ] + } + ] + } + } + } + ] + }, + "span": 85 + }, + { + "kind": { + "StorageLive": 11 + }, + "span": 86 + }, + { + "kind": { + "Assign": [ + { + "local": 11, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 10, + "projection": [] + } + ] + } + ] + }, + "span": 86 + }, + { + "kind": { + "StorageLive": 12 + }, + "span": 87 + }, + { + "kind": { + "StorageLive": 13 + }, + "span": 87 + }, + { + "kind": { + "Assign": [ + { + "local": 13, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [] + } + } + } + ] + }, + "span": 87 + }, + { + "kind": { + "Assign": [ + { + "local": 12, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 13, + "projection": [] + } + ] + } + ] + }, + "span": 87 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 83, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 26, + "id": 7 + } + } + }, + "args": [ + { + "Copy": { + "local": 10, + "projection": [] + } + }, + { + "Copy": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": 15, + "unwind": "Continue" + } + }, + "span": 84 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 6, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 4, + "projection": [ + { + "Downcast": 0 + }, + { + "Field": [ + 0, + 1 + ] + } + ] + } + } + } + ] + }, + "span": 90 + }, + { + "kind": { + "StorageLive": 7 + }, + "span": 91 + }, + { + "kind": { + "Assign": [ + { + "local": 7, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 6, + "projection": [] + } + ] + } + ] + }, + "span": 91 + }, + { + "kind": { + "StorageLive": 8 + }, + "span": 92 + }, + { + "kind": { + "StorageLive": 9 + }, + "span": 92 + }, + { + "kind": { + "Assign": [ + { + "local": 9, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 2, + "projection": [] + } + } + } + ] + }, + "span": 92 + }, + { + "kind": { + "Assign": [ + { + "local": 8, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 9, + "projection": [] + } + ] + } + ] + }, + "span": 92 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 88, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 27, + "id": 8 + } + } + }, + "args": [ + { + "Copy": { + "local": 6, + "projection": [] + } + }, + { + "Copy": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": 16, + "unwind": "Continue" + } + }, + "span": 89 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 3, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 8 + ] + ], + "otherwise": 7 + } + } + }, + "span": 80 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 4 + }, + "span": 95 + }, + { + "kind": { + "StorageLive": 14 + }, + "span": 94 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 93, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 28, + "id": 9 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [] + } + } + ], + "destination": { + "local": 14, + "projection": [] + }, + "target": 9, + "unwind": "Continue" + } + }, + "span": 94 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 4 + }, + "span": 95 + }, + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 96, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 4, + "id": 10 + } + } + } + } + ] + }, + "span": 96 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 14 + } + }, + "span": 96 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 15, + "projection": [] + }, + { + "Discriminant": { + "local": 14, + "projection": [] + } + } + ] + }, + "span": 94 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 15, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 0, + 12 + ], + [ + 1, + 11 + ], + [ + 2, + 10 + ] + ], + "otherwise": 2 + } + } + }, + "span": 97 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 98, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 1 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 4, + "id": 11 + } + } + } + } + ] + }, + "span": 98 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 13 + } + }, + "span": 98 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 20, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 14, + "projection": [ + { + "Downcast": 1 + }, + { + "Field": [ + 0, + 1 + ] + } + ] + } + } + } + ] + }, + "span": 99 + }, + { + "kind": { + "StorageLive": 21 + }, + "span": 100 + }, + { + "kind": { + "Assign": [ + { + "local": 21, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 2, + "projection": [] + } + ] + } + ] + }, + "span": 100 + }, + { + "kind": { + "StorageLive": 22 + }, + "span": 101 + }, + { + "kind": { + "StorageLive": 23 + }, + "span": 101 + }, + { + "kind": { + "Assign": [ + { + "local": 23, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 20, + "projection": [] + } + } + } + ] + }, + "span": 101 + }, + { + "kind": { + "Assign": [ + { + "local": 22, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 23, + "projection": [] + } + ] + } + ] + }, + "span": 101 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 83, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 26, + "id": 7 + } + } + }, + "args": [ + { + "Copy": { + "local": 2, + "projection": [] + } + }, + { + "Move": { + "local": 20, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 17, + "unwind": "Continue" + } + }, + "span": 84 + } + }, + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 16, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 14, + "projection": [ + { + "Downcast": 0 + }, + { + "Field": [ + 0, + 1 + ] + } + ] + } + } + } + ] + }, + "span": 102 + }, + { + "kind": { + "StorageLive": 17 + }, + "span": 103 + }, + { + "kind": { + "Assign": [ + { + "local": 17, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 2, + "projection": [] + } + ] + } + ] + }, + "span": 103 + }, + { + "kind": { + "StorageLive": 18 + }, + "span": 104 + }, + { + "kind": { + "StorageLive": 19 + }, + "span": 104 + }, + { + "kind": { + "Assign": [ + { + "local": 19, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 16, + "projection": [] + } + } + } + ] + }, + "span": 104 + }, + { + "kind": { + "Assign": [ + { + "local": 18, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + "Shared", + { + "local": 19, + "projection": [] + } + ] + } + ] + }, + "span": 104 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 88, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 27, + "id": 8 + } + } + }, + "args": [ + { + "Copy": { + "local": 2, + "projection": [] + } + }, + { + "Move": { + "local": 16, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 18, + "unwind": "Continue" + } + }, + "span": 89 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 14 + }, + "span": 105 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 14 + } + }, + "span": 96 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 3 + }, + "span": 105 + } + ], + "terminator": { + "kind": "Return", + "span": 106 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 12 + }, + "span": 107 + }, + { + "kind": { + "StorageDead": 11 + }, + "span": 107 + }, + { + "kind": { + "StorageDead": 13 + }, + "span": 107 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 6 + } + }, + "span": 107 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 8 + }, + "span": 108 + }, + { + "kind": { + "StorageDead": 7 + }, + "span": 108 + }, + { + "kind": { + "StorageDead": 9 + }, + "span": 108 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 6 + } + }, + "span": 108 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 22 + }, + "span": 109 + }, + { + "kind": { + "StorageDead": 21 + }, + "span": 109 + }, + { + "kind": { + "StorageDead": 23 + }, + "span": 109 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 13 + } + }, + "span": 109 + } + }, + { + "statements": [ + { + "kind": { + "StorageDead": 18 + }, + "span": 110 + }, + { + "kind": { + "StorageDead": 17 + }, + "span": 110 + }, + { + "kind": { + "StorageDead": 19 + }, + "span": 110 + } + ], + "terminator": { + "kind": { + "Goto": { + "target": 13 + } + }, + "span": 110 + } + } + ], + "locals": [ + { + "ty": 4, + "span": 111, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 112, + "mutability": "Not" + }, + { + "ty": 1, + "span": 113, + "mutability": "Not" + }, + { + "ty": 4, + "span": 80, + "mutability": "Mut" + }, + { + "ty": 2, + "span": 79, + "mutability": "Mut" + }, + { + "ty": 11, + "span": 114, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 90, + "mutability": "Not" + }, + { + "ty": 29, + "span": 91, + "mutability": "Mut" + }, + { + "ty": 29, + "span": 92, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 92, + "mutability": "Not" + }, + { + "ty": 1, + "span": 85, + "mutability": "Not" + }, + { + "ty": 29, + "span": 86, + "mutability": "Mut" + }, + { + "ty": 29, + "span": 87, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 87, + "mutability": "Not" + }, + { + "ty": 2, + "span": 94, + "mutability": "Mut" + }, + { + "ty": 11, + "span": 115, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 102, + "mutability": "Not" + }, + { + "ty": 29, + "span": 103, + "mutability": "Mut" + }, + { + "ty": 29, + "span": 104, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 104, + "mutability": "Not" + }, + { + "ty": 1, + "span": 99, + "mutability": "Not" + }, + { + "ty": 29, + "span": 100, + "mutability": "Mut" + }, + { + "ty": 29, + "span": 101, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 101, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 112, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "item", + "source_info": { + "span": 113, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "start", + "source_info": { + "span": 90, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 6, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "start", + "source_info": { + "span": 85, + "scope": 2 + }, + "composite": null, + "value": { + "Place": { + "local": 10, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "end", + "source_info": { + "span": 102, + "scope": 3 + }, + "composite": null, + "value": { + "Place": { + "local": 16, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "end", + "source_info": { + "span": 99, + "scope": 4 + }, + "composite": null, + "value": { + "Place": { + "local": 20, + "projection": [] + } + }, + "argument_index": null + }, + { + "name": "self", + "source_info": { + "span": 116, + "scope": 5 + }, + "composite": null, + "value": { + "Place": { + "local": 11, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 117, + "scope": 5 + }, + "composite": null, + "value": { + "Place": { + "local": 12, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "self", + "source_info": { + "span": 118, + "scope": 6 + }, + "composite": null, + "value": { + "Place": { + "local": 7, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 119, + "scope": 6 + }, + "composite": null, + "value": { + "Place": { + "local": 8, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "self", + "source_info": { + "span": 116, + "scope": 7 + }, + "composite": null, + "value": { + "Place": { + "local": 21, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 117, + "scope": 7 + }, + "composite": null, + "value": { + "Place": { + "local": 22, + "projection": [] + } + }, + "argument_index": 2 + }, + { + "name": "self", + "source_info": { + "span": 118, + "scope": 8 + }, + "composite": null, + "value": { + "Place": { + "local": 17, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "other", + "source_info": { + "span": 119, + "scope": 8 + }, + "composite": null, + "value": { + "Place": { + "local": 18, + "projection": [] + } + }, + "argument_index": 2 + } + ], + "spread_arg": null, + "span": 120 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops5range25RangeInclusive$LT$Idx$GT$8contains17h9cbf222eb05bc29eE", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::ops::RangeInclusive::::contains::", + "id": 9, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 121, + "user_ty": 0, + "const_": { + "kind": "ZeroSized", + "ty": 30, + "id": 12 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 122 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 123 + } + } + ], + "locals": [ + { + "ty": 4, + "span": 124, + "mutability": "Mut" + }, + { + "ty": 3, + "span": 125, + "mutability": "Not" + }, + { + "ty": 1, + "span": 126, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 125, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": 1 + }, + { + "name": "item", + "source_info": { + "span": 126, + "scope": 0 + }, + "composite": null, + "value": { + "Place": { + "local": 2, + "projection": [] + } + }, + "argument_index": 2 + } + ], + "spread_arg": null, + "span": 127 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hc2ff013f58bdd567E", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 10, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 128, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 31, + "id": 13 + } + } + }, + "args": [ + { + "Move": { + "local": 1, + "projection": [ + "Deref" + ] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 128 + } + } + ], + "locals": [ + { + "ty": 20, + "span": 128, + "mutability": "Mut" + }, + { + "ty": 32, + "span": 128, + "mutability": "Not" + }, + { + "ty": 6, + "span": 128, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 128 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce9call_once17h1a38fb0400bcebc9E", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 10, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 3, + "projection": [] + }, + { + "Ref": [ + { + "kind": "ReErased" + }, + { + "Mut": { + "kind": "Default" + } + }, + { + "local": 1, + "projection": [] + } + ] + } + ] + }, + "span": 128 + } + ], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 128, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 33, + "id": 14 + } + } + }, + "args": [ + { + "Move": { + "local": 3, + "projection": [] + } + }, + { + "Move": { + "local": 2, + "projection": [] + } + } + ], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": { + "Cleanup": 3 + } + } + }, + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Drop": { + "place": { + "local": 1, + "projection": [] + }, + "target": 2, + "unwind": "Continue" + } + }, + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Drop": { + "place": { + "local": 1, + "projection": [] + }, + "target": 4, + "unwind": "Terminate" + } + }, + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": "Resume", + "span": 128 + } + } + ], + "locals": [ + { + "ty": 20, + "span": 128, + "mutability": "Mut" + }, + { + "ty": 16, + "span": 128, + "mutability": "Not" + }, + { + "ty": 6, + "span": 128, + "mutability": "Not" + }, + { + "ty": 34, + "span": 128, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 128 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ops8function6FnOnce9call_once17h9b52994615ddc450E", + "mono_item_kind": { + "MonoItemFn": { + "name": ">::call_once", + "id": 10, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Move": { + "local": 1, + "projection": [] + } + }, + "args": [], + "destination": { + "local": 0, + "projection": [] + }, + "target": 1, + "unwind": "Continue" + } + }, + "span": 128 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 128 + } + } + ], + "locals": [ + { + "ty": 6, + "span": 128, + "mutability": "Mut" + }, + { + "ty": 12, + "span": 128, + "mutability": "Not" + }, + { + "ty": 6, + "span": 128, + "mutability": "Not" + } + ], + "arg_count": 2, + "var_debug_info": [], + "spread_arg": 2, + "span": 128 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17he20429edcdf99e41E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::ptr::drop_in_place::<{closure@std::rt::lang_start<()>::{closure#0}}>", + "id": 11, + "body": { + "blocks": [ + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 129 + } + } + ], + "locals": [ + { + "ty": 6, + "span": 129, + "mutability": "Mut" + }, + { + "ty": 32, + "span": 129, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [], + "spread_arg": null, + "span": 129 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17h314067c40d672c7eE", + "mono_item_kind": { + "MonoItemFn": { + "name": "<() as std::process::Termination>::report", + "id": 12, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 131, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 21, + "id": 15 + } + } + } + } + ] + }, + "span": 131 + } + ], + "terminator": { + "kind": "Return", + "span": 130 + } + } + ], + "locals": [ + { + "ty": 21, + "span": 132, + "mutability": "Mut" + }, + { + "ty": 6, + "span": 133, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 133, + "scope": 0 + }, + "composite": null, + "value": { + "Const": { + "span": 49, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 6, + "id": 4 + } + } + }, + "argument_index": 1 + } + ], + "spread_arg": null, + "span": 134 + } + } + }, + "details": null + } + ], + "types": [ + [ + 0, + { + "PrimitiveType": { + "Uint": "U8" + } + } + ], + [ + 1, + { + "RefType": { + "pointee_type": 0, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 2, + { + "EnumType": { + "name": "std::collections::Bound<&u8>", + "adt_def": 1, + "discriminants": [ + 0, + 1, + 2 + ], + "fields": [ + [ + 1 + ], + [ + 1 + ], + [] + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Multiple": { + "tag": { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 2 + } + } + }, + "tag_encoding": "Direct", + "tag_field": 0, + "variants": [ + { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 64 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 2 + } + } + }, + { + "Union": { + "value": { + "Pointer": 0 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + }, + { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 64 + } + ] + } + }, + "variants": { + "Single": { + "index": 1 + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 2 + } + } + }, + { + "Union": { + "value": { + "Pointer": 0 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + }, + { + "fields": { + "Arbitrary": { + "offsets": [] + } + }, + "variants": { + "Single": { + "index": 2 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 64 + } + } + ] + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 2 + } + } + }, + { + "Union": { + "value": { + "Pointer": 0 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + } + } + } + ], + [ + 3, + { + "RefType": { + "pointee_type": 36, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 4, + { + "PrimitiveType": "Bool" + } + ], + [ + 6, + { + "TupleType": { + "types": [], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 0 + } + } + } + } + ], + [ + 10, + { + "RefType": { + "pointee_type": 45, + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + }, + { + "num_bits": 64 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + }, + { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + } + } + } + ], + [ + 11, + { + "PrimitiveType": { + "Int": "Isize" + } + } + ], + [ + 13, + { + "PtrType": { + "pointee_type": 46, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 14, + { + "EnumType": { + "name": "std::result::Result", + "adt_def": 41, + "discriminants": [ + 0, + 1 + ], + "fields": [ + [ + 11 + ], + [ + 39 + ] + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": true + } + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 15, + { + "RefType": { + "pointee_type": 16, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 19, + { + "StructType": { + "name": "std::sys::pal::unix::process::process_common::ExitCode", + "adt_def": 17, + "fields": [ + 0 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I8", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 255 + } + } + } + }, + "abi_align": 1, + "size": { + "num_bits": 8 + } + } + } + } + ], + [ + 20, + { + "PrimitiveType": { + "Int": "I32" + } + } + ], + [ + 21, + { + "StructType": { + "name": "std::process::ExitCode", + "adt_def": 15, + "fields": [ + 19 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Int": { + "length": "I8", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 255 + } + } + } + }, + "abi_align": 1, + "size": { + "num_bits": 8 + } + } + } + } + ], + [ + 22, + { + "RefType": { + "pointee_type": 19, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 29, + { + "RefType": { + "pointee_type": 1, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 32, + { + "PtrType": { + "pointee_type": 16, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 34, + { + "RefType": { + "pointee_type": 16, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 36, + { + "StructType": { + "name": "std::ops::RangeInclusive", + "adt_def": 20, + "fields": [ + 0, + 0, + 4 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 8 + }, + { + "num_bits": 16 + }, + { + "num_bits": 0 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 24 + } + } + } + } + ], + [ + 38, + { + "RefType": { + "pointee_type": 41, + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + }, + { + "num_bits": 64 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "ScalarPair": [ + { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + }, + { + "Initialized": { + "value": { + "Int": { + "length": "I64", + "signed": false + } + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + ] + }, + "abi_align": 8, + "size": { + "num_bits": 128 + } + } + } + } + ], + [ + 39, + "VoidType" + ], + [ + 40, + { + "RefType": { + "pointee_type": 42, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 1, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ], + [ + 41, + { + "PrimitiveType": "Str" + } + ], + [ + 42, + { + "StructType": { + "name": "std::panic::Location<'_>", + "adt_def": 25, + "fields": [ + 38, + 43, + 43 + ], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [ + { + "num_bits": 0 + }, + { + "num_bits": 128 + }, + { + "num_bits": 160 + } + ] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 8, + "size": { + "num_bits": 192 + } + } + } + } + ], + [ + 43, + { + "PrimitiveType": { + "Uint": "U32" + } + } + ], + [ + 46, + { + "PtrType": { + "pointee_type": 0, + "layout": { + "fields": "Primitive", + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Scalar": { + "Initialized": { + "value": { + "Pointer": 0 + }, + "valid_range": { + "start": 0, + "end": 18446744073709551615 + } + } + } + }, + "abi_align": 8, + "size": { + "num_bits": 64 + } + } + } + } + ] + ], + "spans": [ + [ + 0, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 880, + 6, + 880, + 6 + ] + ], + [ + 1, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 879, + 18, + 879, + 29 + ] + ], + [ + 2, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 879, + 9, + 879, + 30 + ] + ], + [ + 4, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 878, + 20, + 878, + 25 + ] + ], + [ + 5, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 878, + 5, + 880, + 6 + ] + ], + [ + 6, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 882, + 12, + 882, + 26 + ] + ], + [ + 7, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 882, + 9, + 888, + 10 + ] + ], + [ + 8, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 885, + 22, + 885, + 31 + ] + ], + [ + 9, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 885, + 13, + 885, + 32 + ] + ], + [ + 10, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 887, + 22, + 887, + 31 + ] + ], + [ + 11, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 887, + 13, + 887, + 32 + ] + ], + [ + 12, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 889, + 6, + 889, + 6 + ] + ], + [ + 13, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 888, + 9, + 888, + 10 + ] + ], + [ + 15, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 881, + 18, + 881, + 23 + ] + ], + [ + 16, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 881, + 5, + 889, + 6 + ] + ], + [ + 17, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 194, + 36 + ] + ], + [ + 18, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 199, + 6 + ] + ], + [ + 19, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 9, + 195, + 93 + ] + ], + [ + 20, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 10, + 195, + 93 + ] + ], + [ + 21, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 201, + 2, + 201, + 2 + ] + ], + [ + 22, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 5, + 199, + 6 + ] + ], + [ + 23, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 12, + 194, + 13 + ] + ], + [ + 24, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 6, + 199, + 7 + ] + ], + [ + 26, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 189, + 5, + 189, + 9 + ] + ], + [ + 27, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 190, + 5, + 190, + 9 + ] + ], + [ + 28, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 191, + 5, + 191, + 9 + ] + ], + [ + 29, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 192, + 5, + 192, + 12 + ] + ], + [ + 30, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 188, + 1, + 201, + 2 + ] + ], + [ + 31, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 69 + ] + ], + [ + 32, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 75 + ] + ], + [ + 33, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 84 + ] + ], + [ + 34, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 70, + 195, + 74 + ] + ], + [ + 35, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 76, + 195, + 82 + ] + ], + [ + 36, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 74, + 195, + 75 + ] + ], + [ + 37, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 93, + 195, + 93 + ] + ], + [ + 38, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 83, + 195, + 84 + ] + ], + [ + 39, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 9, + 2053, + 15 + ] + ], + [ + 40, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 15 + ] + ], + [ + 41, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 22 + ] + ], + [ + 42, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 21, + 636, + 22 + ] + ], + [ + 43, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 23, + 2053, + 24 + ] + ], + [ + 44, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 92, + 195, + 93 + ] + ], + [ + 46, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2052, + 19, + 2052, + 23 + ] + ], + [ + 47, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 635, + 19, + 635, + 24 + ] + ], + [ + 48, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 19 + ] + ], + [ + 49, + [ + "no-location", + 0, + 0, + 0, + 0 + ] + ], + [ + 50, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 21 + ] + ], + [ + 51, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 33 + ] + ], + [ + 52, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 40 + ] + ], + [ + 53, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 160, + 2, + 160, + 2 + ] + ], + [ + 55, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 43, + 150, + 44 + ] + ], + [ + 57, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 9, + 154, + 15 + ] + ], + [ + 58, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs", + 388, + 27, + 388, + 32 + ] + ], + [ + 59, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 1, + 160, + 2 + ] + ], + [ + 60, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 73, + 1722, + 73 + ] + ], + [ + 61, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 52, + 1722, + 59 + ] + ], + [ + 62, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 63, + 1722, + 71 + ] + ], + [ + 63, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 52, + 1722, + 71 + ] + ], + [ + 64, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 70, + 1722, + 71 + ] + ], + [ + 66, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 23, + 1722, + 28 + ] + ], + [ + 67, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 30, + 1722, + 35 + ] + ], + [ + 68, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1722, + 17, + 1722, + 73 + ] + ], + [ + 69, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 72, + 1720, + 72 + ] + ], + [ + 70, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 52, + 1720, + 59 + ] + ], + [ + 71, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 62, + 1720, + 70 + ] + ], + [ + 72, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 52, + 1720, + 70 + ] + ], + [ + 73, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 69, + 1720, + 70 + ] + ], + [ + 75, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 23, + 1720, + 28 + ] + ], + [ + 76, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 30, + 1720, + 35 + ] + ], + [ + 77, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1720, + 17, + 1720, + 72 + ] + ], + [ + 78, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 822, + 21, + 822, + 32 + ] + ], + [ + 79, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 822, + 16, + 822, + 34 + ] + ], + [ + 80, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 822, + 9, + 826, + 11 + ] + ], + [ + 81, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 822, + 9, + 822, + 34 + ] + ], + [ + 82, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 825, + 26, + 825, + 30 + ] + ], + [ + 83, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1836, + 13, + 1836, + 27 + ] + ], + [ + 84, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1836, + 13, + 1836, + 42 + ] + ], + [ + 85, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 824, + 22, + 824, + 27 + ] + ], + [ + 86, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 824, + 32, + 824, + 37 + ] + ], + [ + 87, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 824, + 40, + 824, + 44 + ] + ], + [ + 88, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1840, + 13, + 1840, + 27 + ] + ], + [ + 89, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1840, + 13, + 1840, + 42 + ] + ], + [ + 90, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 823, + 22, + 823, + 27 + ] + ], + [ + 91, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 823, + 32, + 823, + 37 + ] + ], + [ + 92, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 823, + 41, + 823, + 45 + ] + ], + [ + 93, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 826, + 27, + 826, + 36 + ] + ], + [ + 94, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 826, + 22, + 826, + 38 + ] + ], + [ + 95, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 826, + 10, + 826, + 11 + ] + ], + [ + 96, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 822, + 9, + 830, + 11 + ] + ], + [ + 97, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 826, + 15, + 826, + 38 + ] + ], + [ + 98, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 829, + 26, + 829, + 30 + ] + ], + [ + 99, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 828, + 22, + 828, + 25 + ] + ], + [ + 100, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 828, + 30, + 828, + 34 + ] + ], + [ + 101, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 828, + 37, + 828, + 40 + ] + ], + [ + 102, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 827, + 22, + 827, + 25 + ] + ], + [ + 103, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 827, + 30, + 827, + 34 + ] + ], + [ + 104, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 827, + 38, + 827, + 41 + ] + ], + [ + 105, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 830, + 10, + 830, + 11 + ] + ], + [ + 106, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 831, + 6, + 831, + 6 + ] + ], + [ + 107, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 824, + 43, + 824, + 44 + ] + ], + [ + 108, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 823, + 44, + 823, + 45 + ] + ], + [ + 109, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 828, + 39, + 828, + 40 + ] + ], + [ + 110, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 827, + 40, + 827, + 41 + ] + ], + [ + 112, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 817, + 20, + 817, + 25 + ] + ], + [ + 113, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 817, + 27, + 817, + 31 + ] + ], + [ + 116, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1835, + 15, + 1835, + 20 + ] + ], + [ + 117, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1835, + 22, + 1835, + 27 + ] + ], + [ + 118, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1839, + 15, + 1839, + 20 + ] + ], + [ + 119, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs", + 1839, + 22, + 1839, + 27 + ] + ], + [ + 120, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 817, + 5, + 831, + 6 + ] + ], + [ + 121, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 514, + 9, + 514, + 45 + ] + ], + [ + 122, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 514, + 9, + 514, + 57 + ] + ], + [ + 123, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 515, + 6, + 515, + 6 + ] + ], + [ + 125, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 509, + 24, + 509, + 29 + ] + ], + [ + 126, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 509, + 31, + 509, + 35 + ] + ], + [ + 127, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/range.rs", + 509, + 5, + 515, + 6 + ] + ], + [ + 128, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs", + 250, + 5, + 250, + 71 + ] + ], + [ + 129, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs", + 521, + 1, + 521, + 56 + ] + ], + [ + 130, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2424, + 6, + 2424, + 6 + ] + ], + [ + 131, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2423, + 9, + 2423, + 26 + ] + ], + [ + 133, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 15, + 2422, + 19 + ] + ], + [ + 134, + [ + "/Users/steven/.rustup/toolchains/nightly-2024-11-29-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 5, + 2424, + 6 + ] + ], + [ + 135, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 16, + 17, + 24 + ] + ], + [ + 136, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 14, + 17, + 28 + ] + ], + [ + 137, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 14, + 13, + 14, + 14 + ] + ], + [ + 138, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 14, + 17, + 15 + ] + ], + [ + 139, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 25, + 17, + 27 + ] + ], + [ + 140, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 34, + 17, + 42 + ] + ], + [ + 141, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 32, + 17, + 47 + ] + ], + [ + 142, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 32, + 17, + 33 + ] + ], + [ + 143, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 43, + 17, + 46 + ] + ], + [ + 144, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 54, + 17, + 62 + ] + ], + [ + 145, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 52, + 17, + 67 + ] + ], + [ + 146, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 52, + 17, + 53 + ] + ], + [ + 147, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 63, + 17, + 66 + ] + ], + [ + 148, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 14, + 17, + 67 + ] + ], + [ + 149, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 51, + 17, + 67 + ] + ], + [ + 150, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 18, + 13, + 18, + 15 + ] + ], + [ + 151, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 18, + 5, + 18, + 16 + ] + ], + [ + 152, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 19, + 2, + 19, + 2 + ] + ], + [ + 154, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 14, + 9, + 14, + 10 + ] + ], + [ + 155, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 17, + 9, + 17, + 11 + ] + ], + [ + 156, + [ + "/Users/steven/Desktop/projs/kmir/kmir1/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.rs", + 12, + 1, + 19, + 2 + ] + ] + ], + "debug": null, + "machine": { + "endian": "Little", + "pointer_width": { + "num_bits": 64 + } + } +} diff --git a/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.state b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.state new file mode 100644 index 000000000..17f4708f6 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/struct-multi/struct-multi.state @@ -0,0 +1,58 @@ + + + #EndProgram ~> .K + + + noReturn + + + ty ( -1 ) + + + + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 1 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 137 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x1f" , provenance: provenanceMap (... ptrs: .ProvenanceMapEntries ) , align: align ( 1 ) , mutability: mutabilityNot ) ) , ty: ty ( 36 ) , id: mirConstId ( 17 ) ) ) ) ) ) , span: span ( 137 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 4 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 1 ) , projection: .ProjectionElems ) ) ) , span: span ( 138 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 5 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 139 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 0 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty: ty ( 1 ) , id: mirConstId ( 18 ) ) ) ) ) ) , span: span ( 139 ) ) .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 135 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 35 ) , id: mirConstId ( 16 ) ) ) ) , args: operandMove ( place (... local: local ( 4 ) , projection: .ProjectionElems ) ) operandCopy ( place (... local: local ( 5 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 3 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 1 ) ) , unwind: unwindActionContinue ) , span: span ( 136 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindSwitchInt (... discr: operandMove ( place (... local: local ( 3 ) , projection: .ProjectionElems ) ) , targets: switchTargets (... branches: branch ( 0 , basicBlockIdx ( 5 ) ) .Branches , otherwise: basicBlockIdx ( 2 ) ) ) , span: span ( 136 ) ) ) ) + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 7 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 1 ) , projection: .ProjectionElems ) ) ) , span: span ( 142 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 8 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 143 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 1 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty: ty ( 1 ) , id: mirConstId ( 19 ) ) ) ) ) ) , span: span ( 143 ) ) .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 140 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 35 ) , id: mirConstId ( 16 ) ) ) ) , args: operandMove ( place (... local: local ( 7 ) , projection: .ProjectionElems ) ) operandCopy ( place (... local: local ( 8 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 6 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 3 ) ) , unwind: unwindActionContinue ) , span: span ( 141 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindSwitchInt (... discr: operandMove ( place (... local: local ( 6 ) , projection: .ProjectionElems ) ) , targets: switchTargets (... branches: branch ( 0 , basicBlockIdx ( 5 ) ) .Branches , otherwise: basicBlockIdx ( 4 ) ) ) , span: span ( 141 ) ) ) ) + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 10 ) , projection: .ProjectionElems ) , rvalue: rvalueRef ( region (... kind: regionKindReErased ) , borrowKindShared , place (... local: local ( 1 ) , projection: .ProjectionElems ) ) ) , span: span ( 146 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 11 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 147 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 2 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty: ty ( 1 ) , id: mirConstId ( 20 ) ) ) ) ) ) , span: span ( 147 ) ) .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 144 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 35 ) , id: mirConstId ( 16 ) ) ) ) , args: operandMove ( place (... local: local ( 10 ) , projection: .ProjectionElems ) ) operandCopy ( place (... local: local ( 11 ) , projection: .ProjectionElems ) ) .Operands , destination: place (... local: local ( 9 ) , projection: .ProjectionElems ) , target: someBasicBlockIdx ( basicBlockIdx ( 6 ) ) , unwind: unwindActionContinue ) , span: span ( 145 ) ) ) ) + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 2 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 148 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00" , provenance: provenanceMap (... ptrs: .ProvenanceMapEntries ) , align: align ( 1 ) , mutability: mutabilityMut ) ) , ty: ty ( 4 ) , id: mirConstId ( 10 ) ) ) ) ) ) , span: span ( 148 ) ) .Statements , terminator: terminator (... kind: terminatorKindGoto (... target: basicBlockIdx ( 7 ) ) , span: span ( 148 ) ) ) ) + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 2 ) , projection: .ProjectionElems ) , rvalue: rvalueUnaryOp ( unOpNot , operandMove ( place (... local: local ( 9 ) , projection: .ProjectionElems ) ) ) ) , span: span ( 149 ) ) .Statements , terminator: terminator (... kind: terminatorKindGoto (... target: basicBlockIdx ( 7 ) ) , span: span ( 148 ) ) ) ) + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 12 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandCopy ( place (... local: local ( 2 ) , projection: .ProjectionElems ) ) ) ) , span: span ( 150 ) ) .Statements , terminator: terminator (... kind: terminatorKindSwitchInt (... discr: operandMove ( place (... local: local ( 12 ) , projection: .ProjectionElems ) ) , targets: switchTargets (... branches: branch ( 0 , basicBlockIdx ( 8 ) ) .Branches , otherwise: basicBlockIdx ( 9 ) ) ) , span: span ( 150 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 151 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 37 ) , id: mirConstId ( 21 ) ) ) ) , args: operandConstant ( constOperand (... span: span ( 49 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap (... ptrs: provenanceMapEntry (... offset: 0 , allocId: allocId ( 3 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty: ty ( 38 ) , id: mirConstId ( 22 ) ) ) ) .Operands , destination: place (... local: local ( 13 ) , projection: .ProjectionElems ) , target: noBasicBlockIdx , unwind: unwindActionContinue ) , span: span ( 151 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindReturn , span: span ( 152 ) ) ) ) + + + ty ( -1 ) + + + place (... local: local ( 0 ) , projection: .ProjectionElems ) + + + noBasicBlockIdx + + + unwindActionContinue + + + ListItem ( newLocal ( ty ( 6 ) , mutabilityMut ) ) + ListItem ( typedValue ( Aggregate ( variantIdx ( 0 ) , ListItem ( Integer ( 0 , 8 , false ) ) + ListItem ( Integer ( 31 , 8 , false ) ) + ListItem ( BoolVal ( false ) ) ) , ty ( 36 ) , mutabilityNot ) ) + ListItem ( typedValue ( BoolVal ( true ) , ty ( 4 ) , mutabilityNot ) ) + ListItem ( typedValue ( Moved , ty ( 4 ) , mutabilityMut ) ) + ListItem ( typedValue ( Moved , ty ( 3 ) , mutabilityMut ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 1 ) , mutabilityNot ) ) + ListItem ( typedValue ( Moved , ty ( 4 ) , mutabilityMut ) ) + ListItem ( typedValue ( Moved , ty ( 3 ) , mutabilityMut ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 1 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 1 ) , mutabilityNot ) ) + ListItem ( typedValue ( Moved , ty ( 4 ) , mutabilityMut ) ) + ListItem ( typedValue ( Moved , ty ( 3 ) , mutabilityMut ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 2 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 1 ) , mutabilityNot ) ) + ListItem ( typedValue ( Moved , ty ( 4 ) , mutabilityMut ) ) + ListItem ( newLocal ( ty ( 39 ) , mutabilityMut ) ) + + + + ListItem ( StackFrame ( ty ( -1 ) , place (... local: local ( -1 ) , projection: .ProjectionElems ) , noBasicBlockIdx , unwindActionUnreachable , .List ) ) + + \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/show/interior-mut-fail.main.expected b/kmir/src/tests/integration/data/prove-rs/show/interior-mut-fail.main.expected index d387d0c29..7cb6831b6 100644 --- a/kmir/src/tests/integration/data/prove-rs/show/interior-mut-fail.main.expected +++ b/kmir/src/tests/integration/data/prove-rs/show/interior-mut-fail.main.expected @@ -3,10 +3,10 @@ │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC │ span: 0 │ -│ (159 steps) +│ (198 steps) └─ 3 (stuck, leaf) - #traverseProjection ( toStack ( 3 , local ( 1 ) ) , thunk ( UnableToDecode ( b"\ - span: 86 + #traverseProjection ( toLocal ( 11 ) , thunk ( #cast ( PtrLocal ( 3 , place ( .. + span: 91 ┌─ 2 (root, leaf, target, terminal) diff --git a/kmir/src/tests/integration/test_integration.py b/kmir/src/tests/integration/test_integration.py index 179c997ed..6d7893a38 100644 --- a/kmir/src/tests/integration/test_integration.py +++ b/kmir/src/tests/integration/test_integration.py @@ -301,6 +301,18 @@ def test_crate_examples(main_crate: Path, kmir: KMIR, update_expected_output: bo EXEC_DATA_DIR / 'niche-enum' / 'niche-enum.state', None, ), + ( + 'newtype-pubkey', + EXEC_DATA_DIR / 'newtype-pubkey' / 'newtype-pubkey.smir.json', + EXEC_DATA_DIR / 'newtype-pubkey' / 'newtype-pubkey.state', + 1000, + ), + ( + 'struct-multi', + EXEC_DATA_DIR / 'struct-multi' / 'struct-multi.smir.json', + EXEC_DATA_DIR / 'struct-multi' / 'struct-multi.state', + 2000, + ), ] diff --git a/scripts/generate-smir-json.sh b/scripts/generate-smir-json.sh index 4838c8404..3c756d9fe 100755 --- a/scripts/generate-smir-json.sh +++ b/scripts/generate-smir-json.sh @@ -72,6 +72,22 @@ if [ "$FORMAT" = "json" ]; then "$ABS_RUST_FILE") if [ -f "$OUTPUT_FILE" ]; then + # If jq is available, pretty-format the generated JSON in-place + if command -v jq >/dev/null 2>&1; then + TMP_FILE="${OUTPUT_FILE}.tmp" + if jq '.' "$OUTPUT_FILE" > "$TMP_FILE"; then + mv "$TMP_FILE" "$OUTPUT_FILE" + echo "✨ Formatted JSON with jq: $OUTPUT_FILE" + else + rm -f "$TMP_FILE" || true + echo "⚠️ jq formatting failed; keeping original JSON" >&2 + fi + else + echo "ℹ️ jq not found; skipping JSON formatting" + echo " macOS: brew install jq" + echo " Ubuntu/Debian: sudo apt-get install jq" + fi + echo "✅ Successfully generated: $OUTPUT_FILE" echo "📊 File size: $(ls -lh "$OUTPUT_FILE" | awk '{print $5}')" else