-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
refactor: make dsl immutable and cheap to clone #15394
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15394 +/- ##
==========================================
- Coverage 81.26% 81.25% -0.02%
==========================================
Files 1361 1361
Lines 174713 174731 +18
Branches 2531 2531
==========================================
- Hits 141989 141972 -17
- Misses 32240 32273 +33
- Partials 484 486 +2 ☔ View full report in Codecov by Sentry. |
Arc::make_mut(&mut arc); | ||
|
||
// If f panics we must be able to drop the Arc without assuming it is initialized. | ||
let mut uninit_arc = Arc::from_raw(Arc::into_raw(arc).cast::<MaybeUninit<T>>()); |
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.
Does panicking change the repr of T
?
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.
@ritchie46 When an Arc gets dropped due to the panic unwinding it drops the value inside the arc (if it was the last reference). But since we temporarily take out the value using ptr::read
that would be invalid and could lead to double drops. So we change toMaybeUninit
temporarily which has a no-op drop for the value inside the Arc.
No description provided.