Skip to content

Commit d4b9317

Browse files
committed
fix proc-macro that uses std
Signed-off-by: Jorge Prendes <[email protected]>
1 parent 1f7a267 commit d4b9317

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

core/src/context/async.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use future::WithFuture;
6767
macro_rules! async_with{
6868
($context:expr => |$ctx:ident| { $($t:tt)* }) => {
6969
$crate::AsyncContext::async_with(&$context,|$ctx| {
70-
let fut = Box::pin(async move {
70+
let fut = $crate::alloc::boxed::Box::pin(async move {
7171
$($t)*
7272
});
7373
/// SAFETY: While rquickjs objects have a 'js lifetime attached to them,
@@ -81,8 +81,8 @@ macro_rules! async_with{
8181
/// rquickjs objects are send so the future will never be send.
8282
/// Since we acquire a lock before running the future and nothing can escape the closure
8383
/// and future it is safe to recast the future as send.
84-
unsafe fn uplift<'a,'b,R>(f: std::pin::Pin<Box<dyn std::future::Future<Output = R> + 'a>>) -> std::pin::Pin<Box<dyn std::future::Future<Output = R> + 'b + Send>>{
85-
std::mem::transmute(f)
84+
unsafe fn uplift<'a,'b,R>(f: core::pin::Pin<$crate::alloc::boxed::Box<dyn core::future::Future<Output = R> + 'a>>) -> core::pin::Pin<$crate::alloc::boxed::Box<dyn core::future::Future<Output = R> + 'b + Send>>{
85+
core::mem::transmute(f)
8686
}
8787
unsafe{ uplift(fut) }
8888
})

core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#![cfg_attr(feature = "doc-cfg", feature(doc_cfg))]
88
#![cfg_attr(not(test), no_std)]
99

10-
extern crate alloc;
10+
#[doc(hidden)]
11+
pub extern crate alloc;
1112

1213
#[cfg(any(feature = "std", test))]
1314
extern crate std;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
//! - `dump-read-object`
117117
118118
#![cfg_attr(feature = "doc-cfg", feature(doc_cfg))]
119-
#![no_std]
119+
#![cfg_attr(not(test), no_std)]
120120

121121
pub use rquickjs_core::*;
122122

0 commit comments

Comments
 (0)