summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/conversion.rs20
-rw-r--r--src/function.rs7
-rw-r--r--src/lib.rs2
-rw-r--r--src/lua.rs2
-rw-r--r--src/table.rs5
-rw-r--r--src/userdata.rs8
6 files changed, 27 insertions, 17 deletions
diff --git a/src/conversion.rs b/src/conversion.rs
index 4cd444b..ebd6343 100644
--- a/src/conversion.rs
+++ b/src/conversion.rs
@@ -18,7 +18,7 @@ use crate::types::{LightUserData, MaybeSend};
use crate::userdata::{AnyUserData, UserData, UserDataRef, UserDataRefMut};
use crate::value::{FromLua, IntoLua, Nil, Value};
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
use crate::{function::OwnedFunction, table::OwnedTable, userdata::OwnedAnyUserData};
#[cfg(feature = "async")]
@@ -79,7 +79,8 @@ impl<'lua> FromLua<'lua> for Table<'lua> {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> IntoLua<'lua> for OwnedTable {
#[inline]
fn into_lua(self, lua: &'lua Lua) -> Result<Value<'lua>> {
@@ -87,7 +88,8 @@ impl<'lua> IntoLua<'lua> for OwnedTable {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> FromLua<'lua> for OwnedTable {
#[inline]
fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result<OwnedTable> {
@@ -116,7 +118,8 @@ impl<'lua> FromLua<'lua> for Function<'lua> {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> IntoLua<'lua> for OwnedFunction {
#[inline]
fn into_lua(self, lua: &'lua Lua) -> Result<Value<'lua>> {
@@ -124,7 +127,8 @@ impl<'lua> IntoLua<'lua> for OwnedFunction {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> FromLua<'lua> for OwnedFunction {
#[inline]
fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result<OwnedFunction> {
@@ -189,7 +193,8 @@ impl<'lua> FromLua<'lua> for AnyUserData<'lua> {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> IntoLua<'lua> for OwnedAnyUserData {
#[inline]
fn into_lua(self, lua: &'lua Lua) -> Result<Value<'lua>> {
@@ -197,7 +202,8 @@ impl<'lua> IntoLua<'lua> for OwnedAnyUserData {
}
}
-#[cfg(feature = "unstable")]
+#[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+#[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
impl<'lua> FromLua<'lua> for OwnedAnyUserData {
#[inline]
fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result<OwnedAnyUserData> {
diff --git a/src/function.rs b/src/function.rs
index 8e9513d..813517b 100644
--- a/src/function.rs
+++ b/src/function.rs
@@ -33,6 +33,7 @@ pub struct OwnedFunction(pub(crate) crate::types::LuaOwnedRef);
#[cfg(feature = "unstable")]
impl OwnedFunction {
/// Get borrowed handle to the underlying Lua function.
+ #[cfg_attr(feature = "send", allow(unused))]
pub const fn to_ref(&self) -> Function {
Function(self.0.to_ref())
}
@@ -400,8 +401,8 @@ impl<'lua> Function<'lua> {
}
/// Convert this handle to owned version.
- #[cfg(feature = "unstable")]
- #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
+ #[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+ #[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
#[inline]
pub fn into_owned(self) -> OwnedFunction {
OwnedFunction(self.0.into_owned())
@@ -476,6 +477,6 @@ mod assertions {
static_assertions::assert_not_impl_any!(Function: Send);
- #[cfg(feature = "unstable")]
+ #[cfg(all(feature = "unstable", not(feature = "send")))]
static_assertions::assert_not_impl_any!(OwnedFunction: Send);
}
diff --git a/src/lib.rs b/src/lib.rs
index 3733aee..c81a149 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -151,7 +151,7 @@ pub mod serde;
extern crate mlua_derive;
// Unstable features
-#[cfg(all(feature = "unstable", not(feature = "send")))]
+#[cfg(feature = "unstable")]
pub use crate::{function::OwnedFunction, table::OwnedTable, userdata::OwnedAnyUserData};
/// Create a type that implements [`AsChunk`] and can capture Rust variables.
diff --git a/src/lua.rs b/src/lua.rs
index 2ca7281..e5decdf 100644
--- a/src/lua.rs
+++ b/src/lua.rs
@@ -2472,7 +2472,7 @@ impl Lua {
}
}
- #[cfg(feature = "unstable")]
+ #[cfg(all(feature = "unstable", not(feature = "send")))]
pub(crate) fn adopt_owned_ref(&self, loref: crate::types::LuaOwnedRef) -> LuaRef {
assert!(
Arc::ptr_eq(&loref.lua.0, &self.0),
diff --git a/src/table.rs b/src/table.rs
index 015172d..13eeeb6 100644
--- a/src/table.rs
+++ b/src/table.rs
@@ -33,6 +33,7 @@ pub struct OwnedTable(pub(crate) crate::types::LuaOwnedRef);
#[cfg(feature = "unstable")]
impl OwnedTable {
/// Get borrowed handle to the underlying Lua table.
+ #[cfg_attr(feature = "send", allow(unused))]
pub const fn to_ref(&self) -> Table {
Table(self.0.to_ref())
}
@@ -584,8 +585,8 @@ impl<'lua> Table<'lua> {
}
/// Convert this handle to owned version.
- #[cfg(feature = "unstable")]
- #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
+ #[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+ #[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
#[inline]
pub fn into_owned(self) -> OwnedTable {
OwnedTable(self.0.into_owned())
diff --git a/src/userdata.rs b/src/userdata.rs
index 44de70d..c623fda 100644
--- a/src/userdata.rs
+++ b/src/userdata.rs
@@ -746,6 +746,8 @@ pub struct OwnedAnyUserData(pub(crate) crate::types::LuaOwnedRef);
#[cfg(feature = "unstable")]
impl OwnedAnyUserData {
+ /// Get borrowed handle to the underlying Lua userdata.
+ #[cfg_attr(feature = "send", allow(unused))]
pub const fn to_ref(&self) -> AnyUserData {
AnyUserData(self.0.to_ref())
}
@@ -1029,8 +1031,8 @@ impl<'lua> AnyUserData<'lua> {
}
}
- #[cfg(feature = "unstable")]
- #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
+ #[cfg(all(feature = "unstable", any(not(feature = "send"), doc)))]
+ #[cfg_attr(docsrs, doc(cfg(all(feature = "unstable", not(feature = "send")))))]
#[inline]
pub fn into_owned(self) -> OwnedAnyUserData {
OwnedAnyUserData(self.0.into_owned())
@@ -1285,6 +1287,6 @@ mod assertions {
static_assertions::assert_not_impl_any!(AnyUserData: Send);
- #[cfg(feature = "unstable")]
+ #[cfg(all(feature = "unstable", not(feature = "send")))]
static_assertions::assert_not_impl_any!(OwnedAnyUserData: Send);
}