Drop Lua::async_scope as it's unsound

This commit is contained in:
Alex Orlenko
2023-02-12 22:25:10 +00:00
parent f52abf919e
commit b66bff9155
3 changed files with 5 additions and 246 deletions
+1 -22
View File
@@ -56,7 +56,7 @@ use crate::{chunk::Compiler, types::VmState};
use {
crate::types::{AsyncCallback, AsyncCallbackUpvalue, AsyncPollUpvalue},
futures_core::{
future::{Future, LocalBoxFuture},
future::Future,
task::{Context, Poll, Waker},
},
futures_task::noop_waker,
@@ -1887,27 +1887,6 @@ impl Lua {
f(&Scope::new(self))
}
/// An asynchronous version of [`scope`] that allows to create scoped async functions and
/// execute them.
///
/// Requires `feature = "async"`
///
/// [`scope`]: #method.scope
#[cfg(feature = "async")]
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
pub fn async_scope<'lua, 'scope, R, F, FR>(
&'lua self,
f: F,
) -> LocalBoxFuture<'scope, Result<R>>
where
'lua: 'scope,
R: 'static,
F: FnOnce(Scope<'lua, 'scope>) -> FR,
FR: 'scope + Future<Output = Result<R>>,
{
Box::pin(f(Scope::new(self)))
}
/// Attempts to coerce a Lua value into a String in a manner consistent with Lua's internal
/// behavior.
///