diff --git a/kmir/src/kmir/decoding.py b/kmir/src/kmir/decoding.py index 27a2dc019..6943a3798 100644 --- a/kmir/src/kmir/decoding.py +++ b/kmir/src/kmir/decoding.py @@ -47,6 +47,7 @@ from pyk.kast import KInner + from .alloc import DefId from .ty import FieldsShape, LayoutShape, MachineSize, Scalar, TagEncoding, Ty, TypeMetadata, UintTy from .value import MetadataSize @@ -62,7 +63,12 @@ def to_kast(self) -> KInner: ) -def decode_alloc_or_unable(alloc_info: AllocInfo, types: Mapping[Ty, TypeMetadata]) -> Value: +def decode_alloc_or_unable( + alloc_info: AllocInfo, + types: Mapping[Ty, TypeMetadata], + statics: Mapping[DefId, Allocation] | None = None, +) -> Value: + statics = statics or {} match alloc_info: case AllocInfo( ty=ty, @@ -78,12 +84,28 @@ def decode_alloc_or_unable(alloc_info: AllocInfo, types: Mapping[Ty, TypeMetadat data = bytes(n or 0 for n in bytez) return _decode_memory_alloc_or_unable(data=data, ptrs=ptrs, ty=ty, types=types) case AllocInfo( - ty=_, - # `Static` currently only carries `def_id`; we ignore it here. - global_alloc=Static(), + ty=ty, + global_alloc=Static(def_id=def_id), ): - # Static global alloc does not carry raw bytes here; leave as unable-to-decode placeholder - return UnableToDecodeValue('Static global allocation not decoded') + # The static's bytes live in its `MonoItemStatic` item, not in the alloc entry. + # The alloc's `ty` is a reference to the static; decode its contents against the pointee type. + allocation = statics.get(def_id) + if allocation is None: + return UnableToDecodeValue(f'Static allocation not found for def_id: {def_id}') + + try: + type_info = types[ty] + except KeyError: + return UnableToDecodeValue(f'Decoding static allocation with unknown type: {ty}') + + pointee_ty = _pointee_ty(type_info) + if pointee_ty is None: + return UnableToDecodeValue(f'Static allocation type is not a reference or a pointer: {type_info}') + + data = bytes(n or 0 for n in allocation.bytez) + return _decode_memory_alloc_or_unable( + data=data, ptrs=allocation.provenance.ptrs, ty=pointee_ty, types=types + ) case AllocInfo( ty=_, global_alloc=Function( diff --git a/kmir/src/kmir/kompile.py b/kmir/src/kmir/kompile.py index add631a82..b4b1c310d 100644 --- a/kmir/src/kmir/kompile.py +++ b/kmir/src/kmir/kompile.py @@ -662,7 +662,7 @@ def _decode_alloc(smir_info: SMIRInfo, raw_alloc: Any) -> tuple[KInner, KInner]: alloc_id = raw_alloc['alloc_id'] alloc_info = smir_info.allocs[alloc_id] - value = decode_alloc_or_unable(alloc_info=alloc_info, types=smir_info.types) + value = decode_alloc_or_unable(alloc_info=alloc_info, types=smir_info.types, statics=smir_info.statics) match value: case UnableToDecodeValue(msg): diff --git a/kmir/src/kmir/smir.py b/kmir/src/kmir/smir.py index 1ce7b897b..0ee26b106 100644 --- a/kmir/src/kmir/smir.py +++ b/kmir/src/kmir/smir.py @@ -6,7 +6,7 @@ from functools import cached_property from typing import TYPE_CHECKING, NewType -from .alloc import AllocInfo +from .alloc import Allocation, AllocInfo, DefId from .ty import EnumT, RefT, StructT, Ty, TypeMetadata, UnionT if TYPE_CHECKING: @@ -54,6 +54,16 @@ def allocs(self) -> dict[AllocId, AllocInfo]: alloc_info.alloc_id: alloc_info for alloc_info in (AllocInfo.from_dict(dct) for dct in self._smir['allocs']) } + @cached_property + def statics(self) -> dict[DefId, Allocation]: + res: dict[DefId, Allocation] = {} + for item in self._smir['items']: + kind = item['mono_item_kind'] + if 'MonoItemStatic' in kind: + mono_item_static = kind['MonoItemStatic'] + res[DefId(mono_item_static['id'])] = Allocation.from_dict(mono_item_static['allocation']) + return res + @cached_property def types(self) -> dict[Ty, TypeMetadata]: return {Ty(id): TypeMetadata.from_raw(type) for id, type in self._smir['types']} @@ -131,7 +141,11 @@ def function_symbols(self) -> dict[int, dict]: fnc_symbols[-1] = {'NormalSym': self.main_symbol} # function items not present in the SMIR lookup table are added with negative Ty ID - missing = [name for name in self.items.keys() if {'NormalSym': name} not in fnc_symbols.values()] + missing = [ + name + for name, item in self.items.items() + if SMIRInfo._is_func(item) and {'NormalSym': name} not in fnc_symbols.values() + ] fake_ty = -2 for name in missing: @@ -181,6 +195,10 @@ def spans(self) -> dict[int, tuple[Path, int, int, int, int]]: def _is_func(item: dict[str, dict]) -> bool: return 'MonoItemFn' in item['mono_item_kind'] + @staticmethod + def _is_static(item: dict[str, dict]) -> bool: + return 'MonoItemStatic' in item['mono_item_kind'] + def reduce_to(self, start_symbols: str | Sequence[str]) -> SMIRInfo: # returns a new SMIRInfo with all _items_ removed that are not reachable from the named function(s) match start_symbols: @@ -199,10 +217,11 @@ def reduce_to(self, start_symbols: str | Sequence[str]) -> SMIRInfo: new_smir = self._smir.copy() # shallow copy, but we can overwrite the `items` - # filter the new symbols to avoid key errors + # filter the new function symbols to avoid key errors new_syms = [self.function_symbols[ty] for ty in reachable] - new_syms_ = [sym['NormalSym'] for sym in new_syms if 'NormalSym' in sym] - new_smir['items'] = [self.items[sym] for sym in new_syms_ if sym in self.items] + new_syms_ = {sym['NormalSym'] for sym in new_syms if 'NormalSym' in sym} + # Also keep the statics + new_smir['items'] = [item for sym, item in self.items.items() if SMIRInfo._is_static(item) or sym in new_syms_] return SMIRInfo(new_smir) diff --git a/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs b/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs new file mode 100644 index 000000000..d0ae33874 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs @@ -0,0 +1,6 @@ +static NUM: u8 = 55; + +fn main() { + let num_ref = &NUM; + assert!(*num_ref == 55); +} diff --git a/kmir/src/tests/integration/data/exec-smir/references/static_reference.smir.json b/kmir/src/tests/integration/data/exec-smir/references/static_reference.smir.json new file mode 100644 index 000000000..fe6bfc608 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/references/static_reference.smir.json @@ -0,0 +1,2959 @@ +{ + "name": "static_reference", + "crate_id": 8901647797270530167, + "allocs": [ + { + "alloc_id": 1, + "ty": 31, + "global_alloc": { + "Memory": { + "bytes": [ + 97, + 115, + 115, + 101, + 114, + 116, + 105, + 111, + 110, + 32, + 102, + 97, + 105, + 108, + 101, + 100, + 58, + 32, + 42, + 110, + 117, + 109, + 95, + 114, + 101, + 102, + 32, + 61, + 61, + 32, + 53, + 53 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + }, + { + "alloc_id": 0, + "ty": 25, + "global_alloc": { + "Static": 0 + } + } + ], + "functions": [ + [ + 19, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17h83917ebe00af0181E" + } + ], + [ + 21, + { + "NormalSym": "_ZN4core3ops8function6FnOnce9call_once17hd9a0a0c44fc9e375E" + } + ], + [ + 26, + { + "NormalSym": "_ZN4core9panicking5panic17h941160ead03e2d54E" + } + ], + [ + 14, + { + "NormalSym": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17hc6c04818383ec9feE" + } + ], + [ + 20, + { + "IntrinsicSym": "black_box" + } + ], + [ + 13, + { + "NormalSym": "_ZN3std3sys9backtrace28__rust_begin_short_backtrace17h0e6fab5685693372E" + } + ], + [ + 23, + { + "NormalSym": "_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h63cd94c05d198af4E" + } + ], + [ + 0, + { + "NormalSym": "_ZN3std2rt19lang_start_internal17h018b8394ba015d86E" + } + ], + [ + 29, + { + "NoOpSym": "" + } + ] + ], + "uneval_consts": [], + "items": [ + { + "symbol_name": "_ZN16static_reference3NUM17h0f8e785e6673b6adE", + "mono_item_kind": { + "MonoItemStatic": { + "name": "NUM", + "id": 0, + "allocation": { + "bytes": [ + 55 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Not" + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN16static_reference4main17h12d7ba101362d96dE", + "mono_item_kind": { + "MonoItemFn": { + "name": "main", + "id": 7, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 1, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 54, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 0 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 25, + "id": 10 + } + } + } + } + ] + }, + "span": 55 + }, + { + "kind": { + "Assign": [ + { + "local": 2, + "projection": [] + }, + { + "Use": { + "Copy": { + "local": 1, + "projection": [ + "Deref" + ] + } + } + } + ] + }, + "span": 56 + } + ], + "terminator": { + "kind": { + "SwitchInt": { + "discr": { + "Move": { + "local": 2, + "projection": [] + } + }, + "targets": { + "branches": [ + [ + 55, + 1 + ] + ], + "otherwise": 2 + } + } + }, + "span": 53 + } + }, + { + "statements": [], + "terminator": { + "kind": "Return", + "span": 57 + } + }, + { + "statements": [], + "terminator": { + "kind": { + "Call": { + "func": { + "Constant": { + "span": 58, + "user_ty": null, + "const_": { + "kind": "ZeroSized", + "ty": 26, + "id": 11 + } + } + }, + "args": [ + { + "Constant": { + "span": 32, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 32, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "provenance": { + "ptrs": [ + [ + 0, + 1 + ] + ] + }, + "align": 8, + "mutability": "Mut" + } + }, + "ty": 27, + "id": 12 + } + } + } + ], + "destination": { + "local": 3, + "projection": [] + }, + "target": null, + "unwind": "Continue" + } + }, + "span": 58 + } + } + ], + "locals": [ + { + "ty": 1, + "span": 59, + "mutability": "Mut" + }, + { + "ty": 25, + "span": 60, + "mutability": "Not" + }, + { + "ty": 9, + "span": 56, + "mutability": "Mut" + }, + { + "ty": 28, + "span": 58, + "mutability": "Mut" + } + ], + "arg_count": 0, + "var_debug_info": [ + { + "name": "num_ref", + "source_info": { + "span": 60, + "scope": 1 + }, + "composite": null, + "value": { + "Place": { + "local": 1, + "projection": [] + } + }, + "argument_index": null + } + ], + "spread_arg": null, + "span": 61 + } + } + }, + "details": null + }, + { + "symbol_name": "_ZN3std2rt10lang_start17h66fead14a9140bf4E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>", + "id": 1, + "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": [ + 2, + [ + { + "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$17h63cd94c05d198af4E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::rt::lang_start::<()>::{closure#0}", + "id": 2, + "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_backtrace17h0e6fab5685693372E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::sys::backtrace::__rust_begin_short_backtrace::", + "id": 3, + "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$17h59fe4777203c0b8eE", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 4, + "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_once17h83917ebe00af0181E", + "mono_item_kind": { + "MonoItemFn": { + "name": ">::call_once", + "id": 4, + "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_once17hd9a0a0c44fc9e375E", + "mono_item_kind": { + "MonoItemFn": { + "name": "<{closure@std::rt::lang_start<()>::{closure#0}} as std::ops::FnOnce<()>>::call_once", + "id": 4, + "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$17hc93f3cc5ed9c7454E", + "mono_item_kind": { + "MonoItemFn": { + "name": "std::ptr::drop_in_place::<{closure@std::rt::lang_start<()>::{closure#0}}>", + "id": 5, + "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": "_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17hc6c04818383ec9feE", + "mono_item_kind": { + "MonoItemFn": { + "name": "<() as std::process::Termination>::report", + "id": 6, + "body": { + "blocks": [ + { + "statements": [ + { + "kind": { + "Assign": [ + { + "local": 0, + "projection": [] + }, + { + "Use": { + "Constant": { + "span": 46, + "user_ty": null, + "const_": { + "kind": { + "Allocated": { + "bytes": [ + 0 + ], + "provenance": { + "ptrs": [] + }, + "align": 1, + "mutability": "Mut" + } + }, + "ty": 17, + "id": 8 + } + } + } + } + ] + }, + "span": 46 + } + ], + "terminator": { + "kind": "Return", + "span": 45 + } + } + ], + "locals": [ + { + "ty": 17, + "span": 47, + "mutability": "Mut" + }, + { + "ty": 1, + "span": 48, + "mutability": "Not" + } + ], + "arg_count": 1, + "var_debug_info": [ + { + "name": "self", + "source_info": { + "span": 48, + "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": 49 + } + } + }, + "details": null + } + ], + "types": [ + [ + 28, + "VoidType" + ], + [ + 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 + } + }, + "mutability": "Not" + } + } + ], + [ + 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 + } + }, + "mutability": "Mut" + } + } + ], + [ + 30, + { + "RefType": { + "pointee_type": 32, + "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 + } + }, + "mutability": "Not" + } + } + ], + [ + 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 + } + }, + "mutability": "Not" + } + } + ], + [ + 27, + { + "RefType": { + "pointee_type": 31, + "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 + } + }, + "mutability": "Not" + } + } + ], + [ + 25, + { + "RefType": { + "pointee_type": 9, + "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 + } + }, + "mutability": "Not" + } + } + ], + [ + 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 + } + }, + "mutability": "Not" + } + } + ], + [ + 1, + { + "TupleType": { + "types": [], + "layout": { + "fields": { + "Arbitrary": { + "offsets": [] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": true + } + }, + "abi_align": 1, + "size": { + "num_bits": 0 + } + } + } + } + ], + [ + 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 + } + }, + "mutability": "Not" + } + } + ], + [ + 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 + } + }, + "mutability": "Not" + } + } + ], + [ + 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 + } + }, + "mutability": "Mut" + } + } + ], + [ + 34, + { + "DynType": { + "name": "dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe", + "layout": { + "fields": { + "Arbitrary": { + "offsets": [] + } + }, + "variants": { + "Single": { + "index": 0 + } + }, + "abi": { + "Aggregate": { + "sized": false + } + }, + "abi_align": 1, + "size": { + "num_bits": 0 + } + } + } + } + ], + [ + 16, + { + "PrimitiveType": { + "Int": "I32" + } + } + ], + [ + 6, + { + "PrimitiveType": { + "Int": "Isize" + } + } + ], + [ + 32, + { + "StructType": { + "name": "std::panic::Location<'_>", + "adt_def": 10, + "fields": [ + 27, + 33, + 33 + ], + "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 + } + } + } + } + ], + [ + 17, + { + "StructType": { + "name": "std::process::ExitCode", + "adt_def": 15, + "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 + } + } + } + } + ], + [ + 10, + { + "EnumType": { + "name": "std::result::Result", + "adt_def": 24, + "discriminants": [ + 0, + 1 + ], + "fields": [ + [ + 6 + ], + [ + 28 + ] + ], + "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, + { + "StructType": { + "name": "std::sys::pal::unix::process::process_common::ExitCode", + "adt_def": 17, + "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 + } + } + } + } + ], + [ + 31, + { + "PrimitiveType": "Str" + } + ], + [ + 33, + { + "PrimitiveType": { + "Uint": "U32" + } + } + ], + [ + 9, + { + "PrimitiveType": { + "Uint": "U8" + } + } + ], + [ + 12, + { + "FunType": "{closure@std::rt::lang_start<()>::{closure#0}}" + } + ] + ], + "spans": [ + [ + 41, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/hint.rs", + 388, + 27, + 388, + 32 + ] + ], + [ + 34, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 33 + ] + ], + [ + 35, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/hint.rs", + 389, + 5, + 389, + 40 + ] + ], + [ + 43, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs", + 250, + 5, + 250, + 71 + ] + ], + [ + 44, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs", + 521, + 1, + 521, + 56 + ] + ], + [ + 29, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2052, + 19, + 2052, + 23 + ] + ], + [ + 22, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 9, + 2053, + 15 + ] + ], + [ + 26, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2053, + 23, + 2053, + 24 + ] + ], + [ + 49, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 5, + 2424, + 6 + ] + ], + [ + 48, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2422, + 15, + 2422, + 19 + ] + ], + [ + 46, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2423, + 9, + 2423, + 26 + ] + ], + [ + 45, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs", + 2424, + 6, + 2424, + 6 + ] + ], + [ + 13, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 188, + 1, + 201, + 2 + ] + ], + [ + 9, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 189, + 5, + 189, + 9 + ] + ], + [ + 10, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 190, + 5, + 190, + 9 + ] + ], + [ + 11, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 191, + 5, + 191, + 9 + ] + ], + [ + 12, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 192, + 5, + 192, + 12 + ] + ], + [ + 6, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 12, + 194, + 13 + ] + ], + [ + 0, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 194, + 36 + ] + ], + [ + 1, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 194, + 17, + 199, + 6 + ] + ], + [ + 2, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 9, + 195, + 93 + ] + ], + [ + 3, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 10, + 195, + 93 + ] + ], + [ + 14, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 69 + ] + ], + [ + 15, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 75 + ] + ], + [ + 16, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 18, + 195, + 84 + ] + ], + [ + 17, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 70, + 195, + 74 + ] + ], + [ + 19, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 74, + 195, + 75 + ] + ], + [ + 18, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 76, + 195, + 82 + ] + ], + [ + 21, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 83, + 195, + 84 + ] + ], + [ + 27, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 92, + 195, + 93 + ] + ], + [ + 20, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 195, + 93, + 195, + 93 + ] + ], + [ + 5, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 5, + 199, + 6 + ] + ], + [ + 7, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 199, + 6, + 199, + 7 + ] + ], + [ + 4, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs", + 201, + 2, + 201, + 2 + ] + ], + [ + 42, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 1, + 160, + 2 + ] + ], + [ + 38, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 150, + 43, + 150, + 44 + ] + ], + [ + 40, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 9, + 154, + 15 + ] + ], + [ + 31, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 19 + ] + ], + [ + 33, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 154, + 18, + 154, + 21 + ] + ], + [ + 36, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs", + 160, + 2, + 160, + 2 + ] + ], + [ + 30, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 635, + 19, + 635, + 24 + ] + ], + [ + 23, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 15 + ] + ], + [ + 24, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 9, + 636, + 22 + ] + ], + [ + 25, + [ + "/home/zncv/.rustup/toolchains/nightly-2024-11-29-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/process/process_common.rs", + 636, + 21, + 636, + 22 + ] + ], + [ + 50, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 1, + 1, + 1, + 21 + ] + ], + [ + 51, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 1, + 18, + 1, + 20 + ] + ], + [ + 61, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 3, + 1, + 6, + 2 + ] + ], + [ + 60, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 4, + 9, + 4, + 16 + ] + ], + [ + 55, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 4, + 19, + 4, + 23 + ] + ], + [ + 54, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 4, + 20, + 4, + 23 + ] + ], + [ + 58, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 5, + 5, + 5, + 28 + ] + ], + [ + 56, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 5, + 13, + 5, + 21 + ] + ], + [ + 53, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 5, + 13, + 5, + 27 + ] + ], + [ + 57, + [ + "/home/zncv/Applications/mir-semantics/kmir/src/tests/integration/data/exec-smir/references/static_reference.rs", + 6, + 2, + 6, + 2 + ] + ], + [ + 32, + [ + "no-location", + 0, + 0, + 0, + 0 + ] + ] + ], + "debug": null, + "machine": { + "endian": "Little", + "pointer_width": { + "num_bits": 64 + } + } +} diff --git a/kmir/src/tests/integration/data/exec-smir/references/static_reference.state b/kmir/src/tests/integration/data/exec-smir/references/static_reference.state new file mode 100644 index 000000000..ee6e34c92 --- /dev/null +++ b/kmir/src/tests/integration/data/exec-smir/references/static_reference.state @@ -0,0 +1,51 @@ + + + #EndProgram ~> .K + + + noReturn + + + ty ( -1 ) + + + + ListItem ( basicBlock (... statements: statement (... kind: statementKindAssign (... place: place (... local: local ( 1 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandConstant ( constOperand (... span: span ( 54 ) , 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 ( 25 ) , id: mirConstId ( 10 ) ) ) ) ) ) , span: span ( 55 ) ) statement (... kind: statementKindAssign (... place: place (... local: local ( 2 ) , projection: .ProjectionElems ) , rvalue: rvalueUse ( operandCopy ( place (... local: local ( 1 ) , projection: projectionElemDeref .ProjectionElems ) ) ) ) , span: span ( 56 ) ) .Statements , terminator: terminator (... kind: terminatorKindSwitchInt (... discr: operandMove ( place (... local: local ( 2 ) , projection: .ProjectionElems ) ) , targets: switchTargets (... branches: branch ( 55 , basicBlockIdx ( 1 ) ) .Branches , otherwise: basicBlockIdx ( 2 ) ) ) , span: span ( 53 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindReturn , span: span ( 57 ) ) ) ) + ListItem ( basicBlock (... statements: .Statements , terminator: terminator (... kind: terminatorKindCall (... func: operandConstant ( constOperand (... span: span ( 58 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindZeroSized , ty: ty ( 26 ) , id: mirConstId ( 11 ) ) ) ) , args: operandConstant ( constOperand (... span: span ( 32 ) , userTy: noUserTypeAnnotationIndex , const: mirConst (... kind: constantKindAllocated ( allocation (... bytes: b"\x00\x00\x00\x00\x00\x00\x00\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 ( 27 ) , id: mirConstId ( 12 ) ) ) ) .Operands , destination: place (... local: local ( 3 ) , projection: .ProjectionElems ) , target: noBasicBlockIdx , unwind: unwindActionContinue ) , span: span ( 58 ) ) ) ) + + + ty ( -1 ) + + + place (... local: local ( 0 ) , projection: .ProjectionElems ) + + + noBasicBlockIdx + + + unwindActionContinue + + + ListItem ( newLocal ( ty ( 1 ) , mutabilityMut ) ) + ListItem ( typedValue ( AllocRef ( allocId ( 0 ) , .ProjectionElems , metadata ( noMetadataSize , 0 , noMetadataSize ) ) , ty ( 25 ) , mutabilityNot ) ) + ListItem ( typedValue ( Moved , ty ( 9 ) , mutabilityMut ) ) + ListItem ( newLocal ( ty ( 28 ) , mutabilityMut ) ) + + + span ( 53 ) + + + + ListItem ( StackFrame ( ty ( -1 ) , place (... local: local ( -1 ) , projection: .ProjectionElems ) , noBasicBlockIdx , unwindActionUnreachable , .List , span ( 0 ) ) ) + + + noMap + + + noMap + + + noMap + + \ No newline at end of file diff --git a/kmir/src/tests/integration/data/prove-rs/show/static_pointer-fail.main.expected b/kmir/src/tests/integration/data/prove-rs/show/static_pointer-fail.main.expected new file mode 100644 index 000000000..7b3d0e525 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/show/static_pointer-fail.main.expected @@ -0,0 +1,22 @@ + +┌─ 1 (root, init) +│ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC +│ span: 0 +│ +│ (21 steps) +├─ 3 +│ #mkPtr ( toAlloc ( allocId ( 0 ) ) , .ProjectionElems , mutabilityNot , metadata +│ function: main +│ span: 56 +│ +│ (1 step) +└─ 4 (leaf, terminal) + thunk ( #mkPtr ( toAlloc ( allocId ( 0 ) ) , .ProjectionElems , mutabilityNot , + function: main + span: 56 + + +┌─ 2 (root, leaf, target, terminal) +│ #EndProgram ~> .K + + diff --git a/kmir/src/tests/integration/data/prove-rs/show/volatile_load_static-fail.main.expected b/kmir/src/tests/integration/data/prove-rs/show/volatile_load_static-fail.main.expected index 17d43bcad..f50b7b7a0 100644 --- a/kmir/src/tests/integration/data/prove-rs/show/volatile_load_static-fail.main.expected +++ b/kmir/src/tests/integration/data/prove-rs/show/volatile_load_static-fail.main.expected @@ -3,17 +3,17 @@ │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC │ span: 0 │ -│ (11 steps) +│ (21 steps) ├─ 3 -│ #decodeConstant ( constantKindAllocated ( allocation ( ... bytes: b"\x00\x00\x00 +│ #mkPtr ( toAlloc ( allocId ( 0 ) ) , .ProjectionElems , mutabilityNot , metadata │ function: main -│ span: 56 +│ span: 53 │ │ (1 step) └─ 4 (leaf, terminal) - thunk ( #decodeConstant ( constantKindAllocated ( allocation ( ... bytes: b"\x00 + thunk ( #mkPtr ( toAlloc ( allocId ( 0 ) ) , .ProjectionElems , mutabilityNot , function: main - span: 56 + span: 53 ┌─ 2 (root, leaf, target, terminal) diff --git a/kmir/src/tests/integration/data/prove-rs/static_pointer-fail.rs b/kmir/src/tests/integration/data/prove-rs/static_pointer-fail.rs new file mode 100644 index 000000000..4fe2cb8fb --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/static_pointer-fail.rs @@ -0,0 +1,8 @@ +static NUM: u8 = 55; + +fn main() { + let num_ptr = &NUM as *const u8; + unsafe { + assert!(*num_ptr == 55); + } +} diff --git a/kmir/src/tests/integration/data/prove-rs/static_reference.rs b/kmir/src/tests/integration/data/prove-rs/static_reference.rs new file mode 120000 index 000000000..47e6a9735 --- /dev/null +++ b/kmir/src/tests/integration/data/prove-rs/static_reference.rs @@ -0,0 +1 @@ +../exec-smir/references/static_reference.rs \ No newline at end of file diff --git a/kmir/src/tests/integration/test_integration.py b/kmir/src/tests/integration/test_integration.py index 10b29bb81..1ad957c62 100644 --- a/kmir/src/tests/integration/test_integration.py +++ b/kmir/src/tests/integration/test_integration.py @@ -72,6 +72,7 @@ 'ptr-cast-array-to-wrapper-fail', 'ptr-cast-array-to-nested-wrapper-fail', 'ptr-cast-array-to-singleton-wrapped-array-fail', + 'static_pointer-fail', ] @@ -542,6 +543,12 @@ def test_crate_examples(main_crate: Path, kmir: KMIR, update_expected_output: bo EXEC_DATA_DIR / 'references' / 'array_elem_ref.state', None, ), + ( + 'Ref-static_reference', + EXEC_DATA_DIR / 'references' / 'static_reference.smir.json', + EXEC_DATA_DIR / 'references' / 'static_reference.state', + None, + ), ( 'intrinsic-blackbox', EXEC_DATA_DIR / 'intrinsic' / 'blackbox.smir.json',