Fix sync build.

This commit is contained in:
Stephen Chung
2021-03-06 22:07:20 +08:00
parent 4da5af8aae
commit e87f981674
3 changed files with 23 additions and 14 deletions

View File

@@ -1195,18 +1195,24 @@ impl Dynamic {
match self.0 {
Union::Shared(_, _) => match crate::stdlib::mem::take(self).0 {
Union::Shared(cell, _) => {
let value = crate::fn_native::shared_take_or_clone(cell);
*self = crate::fn_native::shared_try_take(cell).map_or_else(
|cell| {
#[cfg(not(feature = "sync"))]
let value = cell.borrow();
#[cfg(feature = "sync")]
let value = cell.read().unwrap();
#[cfg(not(feature = "sync"))]
{
*self = value.into_inner();
}
#[cfg(feature = "sync")]
{
*self = value.into_inner().unwrap();
}
value.clone()
},
|value| {
#[cfg(not(feature = "sync"))]
return value.into_inner();
#[cfg(feature = "sync")]
return value.into_inner().unwrap();
},
)
}
_ => unreachable!(),
_ => unreachable!("self should be Shared"),
},
_ => (),
}