Skip to content

Commit

Permalink
Support no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 24, 2019
1 parent 2bd4733 commit 947f77b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fn transform_sig(context: Context, sig: &mut MethodSig, has_default: bool) {
where_clause.predicates.push(if assume_bound {
parse_quote!(Self: #lifetime)
} else {
parse_quote!(Self: std::marker::#bound + #lifetime)
parse_quote!(Self: core::marker::#bound + #lifetime)
});
}
} else {
Expand All @@ -188,8 +188,8 @@ fn transform_sig(context: Context, sig: &mut MethodSig, has_default: bool) {
}

sig.decl.output = parse_quote! {
-> std::pin::Pin<std::boxed::Box<
dyn std::future::Future<Output = #ret> + std::marker::Send + #lifetime
-> core::pin::Pin<Box<
dyn core::future::Future<Output = #ret> + core::marker::Send + #lifetime
>>
};
}
Expand Down Expand Up @@ -272,7 +272,7 @@ fn transform_block(context: Context, sig: &MethodSig, block: &mut Block) {
};
let (_, generics, _) = generics.split_for_impl();
standalone.decl.generics.params.push(parse_quote! {
AsyncTrait: ?Sized + #name #generics + std::marker::#bound
AsyncTrait: ?Sized + #name #generics + core::marker::#bound
});
types.push(Ident::new("Self", Span::call_site()));
}
Expand All @@ -290,7 +290,7 @@ fn transform_block(context: Context, sig: &MethodSig, block: &mut Block) {
};
let (_, generics, _) = generics.split_for_impl();
standalone.decl.generics.params.push(parse_quote! {
AsyncTrait: ?Sized + #name #generics + std::marker::Send
AsyncTrait: ?Sized + #name #generics + core::marker::Send
});
types.push(Ident::new("Self", Span::call_site()));
}
Expand Down Expand Up @@ -322,7 +322,7 @@ fn transform_block(context: Context, sig: &MethodSig, block: &mut Block) {
let brace = block.brace_token;
*block = parse_quote!({
#standalone #block
std::pin::Pin::from(std::boxed::Box::new(#inner::<#(#types),*>(#(#args),*)))
core::pin::Pin::from(Box::new(#inner::<#(#types),*>(#(#args),*)))
});
block.brace_token = brace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
//! impl Advertisement for AutoplayingVideo {
//! fn run<'async>(
//! &'async self,
//! ) -> Pin<Box<dyn std::future::Future<Output = ()> + Send + 'async>>
//! ) -> Pin<Box<dyn core::future::Future<Output = ()> + Send + 'async>>
//! where
//! Self: Sync + 'async,
//! {
Expand Down

0 comments on commit 947f77b

Please sign in to comment.