Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Add a debug mode for Heap<T> that can detect some invalid moves of Heap objects #417

Open
jdm opened this issue Mar 29, 2018 · 0 comments
Open

Comments

@jdm
Copy link
Member

jdm commented Mar 29, 2018

If we add a Cell<*mut Self> member to Heap<T> that is conditionally compiled, initialize it to null, and set it to self as *const Self whenever Heap::set is invoked, we can assert that the cell value is either null or equal to self as *const Self. This will automatically assert any time that a Heap value is set to a non-default value, moved (thus invalidating the pointer stored by SM), and set once more. This can't flag any moves that occur when no mutation follows, but it's better than nothing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant