We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ThreadGuard::into_inner
1 parent 7ef541b commit 5829535Copy full SHA for 5829535
glib/src/thread_guard.rs
@@ -87,14 +87,14 @@ impl<T> ThreadGuard<T> {
87
/// created.
88
#[inline]
89
pub fn into_inner(self) -> T {
90
+ // We wrap `self` in `ManuallyDrop` to defuse `ThreadGuard`'s `Drop` impl.
91
+ let mut this = ManuallyDrop::new(self);
92
+
93
assert!(
- self.thread_id == thread_id(),
94
+ this.thread_id == thread_id(),
95
"Value accessed from different thread than where it was created"
96
);
97
- // We wrap `self` in `ManuallyDrop` to defuse `ThreadGuard`'s `Drop` impl.
- let mut this = ManuallyDrop::new(self);
-
98
// SAFETY: We are on the right thread, and this.value will not be touched after this
99
unsafe { ManuallyDrop::take(&mut this.value) }
100
}
0 commit comments