Skip to content

Fix element ownership tracking with may_dangle - #3

Open
charliermarsh wants to merge 1 commit into
v1from
charlie/codex-fix-may-dangle
Open

Fix element ownership tracking with may_dangle#3
charliermarsh wants to merge 1 commit into
v1from
charlie/codex-fix-may-dangle

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

With may_dangle enabled, we currently allow references read by an element's destructor to expire before the vector is dropped, causing a use-after-free.

Track ownership of A::Item with PhantomData so drop checking rejects this, including spilled vectors with zero inline capacity. Plain borrowed references without destructors retain the intended may_dangle behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant