From a54b88a8b0edc50dd7afddfcba66cbee6eee34a6 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 6 Feb 2021 22:16:44 +0800 Subject: [PATCH] Dynamic::into_shared not available under no_closure. --- RELEASES.md | 6 ++++++ src/dynamic.rs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index ab0e7ceb..6d20a5ba 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -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 =============== diff --git a/src/dynamic.rs b/src/dynamic.rs index c89c1250..c5d9f960 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -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)),