Dynamic::into_shared not available under no_closure.

This commit is contained in:
Stephen Chung 2021-02-06 22:16:44 +08:00
parent dff124b242
commit a54b88a8b0
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,12 @@ Rhai Release Notes
Version 0.19.12
===============
Breaking changes
----------------
* `Dynamic::into_shared` is no longer available under `no_closure`. It used to panic.
Version 0.19.11
===============

View File

@ -761,6 +761,8 @@ impl Dynamic {
/// [`Arc`][std::sync::Arc]`<`[`RwLock`][std::sync::RwLock]`<`[`Dynamic`]`>>`
/// depending on the `sync` feature.
///
/// Not available under [`no_closure`].
///
/// Shared [`Dynamic`] values are relatively cheap to clone as they simply increment the
/// reference counts.
///
@ -772,11 +774,11 @@ impl Dynamic {
/// # Panics
///
/// Panics under the `no_closure` feature.
#[cfg(not(feature = "no_closure"))]
#[inline(always)]
pub fn into_shared(self) -> Self {
let _access = self.access_mode();
#[cfg(not(feature = "no_closure"))]
return match self.0 {
Union::Shared(_, _) => self,
_ => Self(Union::Shared(crate::Locked::new(self).into(), _access)),