Fix sync build.
This commit is contained in:
parent
4da5af8aae
commit
e87f981674
@ -1195,18 +1195,24 @@ impl Dynamic {
|
|||||||
match self.0 {
|
match self.0 {
|
||||||
Union::Shared(_, _) => match crate::stdlib::mem::take(self).0 {
|
Union::Shared(_, _) => match crate::stdlib::mem::take(self).0 {
|
||||||
Union::Shared(cell, _) => {
|
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"))]
|
#[cfg(not(feature = "sync"))]
|
||||||
{
|
let value = cell.borrow();
|
||||||
*self = value.into_inner();
|
|
||||||
}
|
|
||||||
#[cfg(feature = "sync")]
|
#[cfg(feature = "sync")]
|
||||||
{
|
let value = cell.read().unwrap();
|
||||||
*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!("self should be Shared"),
|
||||||
_ => unreachable!(),
|
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
@ -405,8 +405,8 @@ impl<'a> Target<'a> {
|
|||||||
Self::LockGuard((r, _)) => **r = new_val,
|
Self::LockGuard((r, _)) => **r = new_val,
|
||||||
Self::Value(_) => panic!("cannot update a value"),
|
Self::Value(_) => panic!("cannot update a value"),
|
||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
Self::StringChar(string, index, _) if string.is::<ImmutableString>() => {
|
Self::StringChar(s, index, _) if s.is::<ImmutableString>() => {
|
||||||
let mut s = string.write_lock::<ImmutableString>().unwrap();
|
let mut s = s.write_lock::<ImmutableString>().unwrap();
|
||||||
|
|
||||||
// Replace the character at the specified index position
|
// Replace the character at the specified index position
|
||||||
let new_ch = new_val.as_char().map_err(|err| {
|
let new_ch = new_val.as_char().map_err(|err| {
|
||||||
@ -426,7 +426,10 @@ impl<'a> Target<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
Self::StringChar(_, _, _) => unreachable!(),
|
Self::StringChar(s, _, _) => unreachable!(
|
||||||
|
"Target::StringChar should contain only a string, not {}",
|
||||||
|
s.type_name()
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -147,7 +147,7 @@ impl From<&crate::module::FuncInfo> for FnMetadata {
|
|||||||
doc_comments: if info.func.is_script() {
|
doc_comments: if info.func.is_script() {
|
||||||
#[cfg(feature = "no_function")]
|
#[cfg(feature = "no_function")]
|
||||||
{
|
{
|
||||||
unreachable!()
|
unreachable!("scripted functions should not exist under no_function")
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user