-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
I think this communicates the intent better, and is shorter anyway.
r? @KodrAus (rust_highfive has picked a reviewer for you, use r? to override) |
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+ |
📌 Commit f302407 has been approved by |
@@ -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); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
☀️ Test successful - checks-actions, checks-azure |
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 |
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: