Skip to content

Commit 6d61698

Browse files
committed
fix(rt): Handle zero-sized locals on borrow
1 parent 864994b commit 6d61698

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

kmir/src/kmir/kdist/mir-semantics/rt/data.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,14 +1073,7 @@ This eliminates any `Deref` projections from the place, and also resolves `Index
10731073
10741074
// Borrowing a zero-sized local that is still `NewLocal`: initialise it, then reuse the regular rule.
10751075
rule <k> rvalueRef(REGION, KIND, place(local(I), PROJS))
1076-
=> #forceSetLocal(
1077-
local(I),
1078-
#decodeConstant(
1079-
constantKindZeroSized,
1080-
tyOfLocal(getLocal(LOCALS, I)),
1081-
lookupTy(tyOfLocal(getLocal(LOCALS, I)))
1082-
)
1083-
)
1076+
=> #forceSetLocal(local(I), Aggregate(variantIdx(0), .List))
10841077
~> rvalueRef(REGION, KIND, place(local(I), PROJS))
10851078
...
10861079
</k>

kmir/src/kmir/kdist/mir-semantics/rt/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Slices, `str`s and dynamic types require it, and any `Ty` that `is_sized` does
193193
```k
194194
syntax Bool ::= #zeroSizedType ( TypeInfo ) [function, total]
195195
196-
rule #zeroSizedType(typeInfoTupleType(.Tys, _)) => true
196+
rule #zeroSizedType(typeInfoTupleType(.Tys)) => true
197197
rule #zeroSizedType(typeInfoStructType(_, _, .Tys, _)) => true
198198
rule #zeroSizedType(typeInfoVoidType) => true
199199
// FIXME: Only unit tuples, empty structs, and void are recognized here; other

0 commit comments

Comments
 (0)