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

Do not drop AppendVec in store-tool #32739

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Aug 7, 2023

Problem

The store-tool should remove cause the backing storage of the AppendVec it inspects to be removed. Currently, that's accomplished via toggling the AppendVec::remove_on_drop field. Now that Rust has ManuallyDrop, we can (i.e. should) use that instead.

Summary of Changes

Use ManuallyDrop to not remove the backing store.

Miscellaneous

Here's an example of using ManuallyDrop, create a wrapper to not drop, and then another wrapper than can drop. Useful if ManuallyDrop is new-to-you: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c5322f69ab160d2d557162f6c325a29e

@brooksprumo brooksprumo self-assigned this Aug 7, 2023
@yhchiang-sol yhchiang-sol self-requested a review August 7, 2023 15:41
@brooksprumo brooksprumo marked this pull request as ready for review August 7, 2023 15:55
Copy link
Contributor

@yhchiang-sol yhchiang-sol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Thanks for spotting this!

@codecov
Copy link

codecov bot commented Aug 7, 2023

Codecov Report

Merging #32739 (777ec0f) into master (533f42d) will increase coverage by 0.0%.
Report is 10 commits behind head on master.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #32739   +/-   ##
=======================================
  Coverage    81.9%    82.0%           
=======================================
  Files         784      784           
  Lines      211004   211004           
=======================================
+ Hits       173012   173029   +17     
+ Misses      37992    37975   -17     

@brooksprumo brooksprumo merged commit 6ce647a into solana-labs:master Aug 7, 2023
@brooksprumo brooksprumo deleted the no-drop/store-tool branch August 7, 2023 16:15
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.

2 participants