Skip to content

Insert CheckRefs after calling destructors

Yorick Peterse requested to merge check-refs-after-destructor into master

Destructors may leak references of "self" through mutable references stored in "self". For example, a value storing a mut Array[mut X] could leak "self" (provided it's of type X) by pushing "self" into said array.

To solve this we now insert the CheckRefs instruction after calling a destructor. For correct programs this won't make a difference, while incorrect programs may perform some redundant work in a destructor before terminating with a panic.

This fixes #254 (closed).

Merge request reports