Skip to content

Commit 17b71cc

Browse files
committed
fix(rt): Handle zero-sized locals on borrow
1 parent 395e132 commit 17b71cc

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

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
@@ -148,7 +148,7 @@ Slices, `str`s and dynamic types require it, and any `Ty` that `is_sized` does
148148
```k
149149
syntax Bool ::= #zeroSizedType ( TypeInfo ) [function, total]
150150
151-
rule #zeroSizedType(typeInfoTupleType(.Tys, _)) => true
151+
rule #zeroSizedType(typeInfoTupleType(.Tys)) => true
152152
rule #zeroSizedType(typeInfoStructType(_, _, .Tys, _)) => true
153153
rule #zeroSizedType(typeInfoVoidType) => true
154154
// FIXME: Only unit tuples, empty structs, and void are recognized here; other

0 commit comments

Comments
 (0)