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

Suggest mem::forget if mem::ManuallyDrop::new isn't used #75912

Merged
merged 1 commit into from
Aug 26, 2020

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Aug 25, 2020

I think this communicates the intent more idiomatically, and is shorter anyway.

Inspired because it came up on URLO, and it turns out that std had done it too in one spot:
image

I think this communicates the intent better, and is shorter anyway.
@rust-highfive
Copy link
Collaborator

r? @KodrAus

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2020
@Mark-Simulacrum
Copy link
Member

I agree that this seems more idiomatic, and overall better. Since it's just a diagnostic should also be easy to revert at any point. @bors r+

@bors
Copy link
Contributor

bors commented Aug 25, 2020

📌 Commit f302407 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2020
@@ -293,7 +293,7 @@ impl<T> SyncOnceCell<T> {

// Don't drop this `SyncOnceCell`. We just moved out one of the fields, but didn't set
// the state to uninitialized.
mem::ManuallyDrop::new(self);
mem::forget(self);
Copy link
Member

Choose a reason for hiding this comment

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

FYI @matklad you may want to upstream this change to once_cell.

Copy link
Member

Choose a reason for hiding this comment

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

If you want to be notified about changes to lazy.rs you can add yourself to highfive list: https://github.com/rust-lang/highfive/blob/master/highfive/configs/rust-lang/rust.json

@bors
Copy link
Contributor

bors commented Aug 26, 2020

⌛ Testing commit f302407 with merge 48717b6...

@bors
Copy link
Contributor

bors commented Aug 26, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Mark-Simulacrum
Pushing 48717b6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 26, 2020
@bors bors merged commit 48717b6 into rust-lang:master Aug 26, 2020
@rust-log-analyzer
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants