15 lines
456 B
Mojo
15 lines
456 B
Mojo
# probe: is a struct's List field safe to assign in a loop when nothing reads the struct afterwards? (no: the built program crashes on a later pass; with the last line uncommented it runs)
|
|
@fieldwise_init
|
|
struct Origin(Copyable, Movable):
|
|
var hash: List[Int]
|
|
|
|
|
|
def main():
|
|
var r = Origin(List[Int]())
|
|
for e in range(3):
|
|
print("pass", e)
|
|
var f = List[Int]()
|
|
f.append(2)
|
|
r.hash = f.copy()
|
|
# print(len(r.hash))
|