Skip to content

Fix warning about unused_must_use for Box::from_raw #860

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Jul 18, 2022

rust-lang/rust#99270 recently added a must_use for Box::from_raw. This causes this particular line to raise a warning. This solves it by explicitly dropping the value. This code was storing a pointer to a Rust structure using Box::into_raw. This drop impl was reconstituting it as a Box in order to free the memory. However, this doesn't care about the return value as it is only doing this to then immediately drop and free the value.

@alexcrichton alexcrichton merged commit 46674ce into rust-lang:master Jul 19, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants