Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(allocator): prevent putting drop types into arena #6626

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Oct 16, 2024

Should not be merged.

Is a quick and dirty check that we do not put any drop types into either oxc_allocator::Box or oxc_allocator::Vec.

Unfortunately, this is probably not reliable enough to use. From needs_drop's docs:

May be implemented conservatively: it may return true for types that don’t actually need to be dropped. As such always returning true would be a valid implementation of this function. However if this function actually returns false, then you can be certain dropping T has no side effect.

So the fact that tests and conformance pass on this PR does prove that no code path that they exercise attempts to put Drop types into Box or Vec. So this demonstrates that #6623 does not introduce any memory leaks. Good!

However, as the docs say, we cannot rely on needs_drop not producing false positives, so this could start producing erroneous compilation errors in a future version of Rust.

Copy link
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @overlookmotel and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added the C-bug Category - Bug label Oct 16, 2024
Copy link

graphite-app bot commented Oct 16, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link

codspeed-hq bot commented Oct 16, 2024

CodSpeed Performance Report

Merging #6626 will not alter performance

Comparing 10-16-fix_allocator_prevent_putting_drop_types_into_arena (240ea95) with 10-16-refactor_allocator_make_vec_non-drop (45bdb68)

Summary

✅ 30 untouched benchmarks

@Dunqing Dunqing force-pushed the 10-16-refactor_allocator_make_vec_non-drop branch from 8ddc979 to 3e8b3ed Compare October 16, 2024 15:10
@Dunqing Dunqing force-pushed the 10-16-fix_allocator_prevent_putting_drop_types_into_arena branch from f5e8578 to 9c2ed7b Compare October 16, 2024 15:11
@overlookmotel overlookmotel force-pushed the 10-16-refactor_allocator_make_vec_non-drop branch from 3e8b3ed to 45bdb68 Compare October 16, 2024 15:34
@overlookmotel overlookmotel force-pushed the 10-16-fix_allocator_prevent_putting_drop_types_into_arena branch from 9c2ed7b to 240ea95 Compare October 16, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant