Skip to content

Commit

Permalink
Merge pull request #41 from Marwes/core
Browse files Browse the repository at this point in the history
fix: Always refer to the core crate
  • Loading branch information
dtolnay authored Oct 15, 2019
2 parents 4cc7d23 + 57b3652 commit a0cc8c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fn transform_sig(
where_clause.predicates.push(if assume_bound || is_local {
parse_quote!(Self: #lifetime)
} else {
parse_quote!(Self: core::marker::#bound + #lifetime)
parse_quote!(Self: ::core::marker::#bound + #lifetime)
});
}
} else {
Expand Down Expand Up @@ -222,12 +222,12 @@ fn transform_sig(
let bounds = if is_local {
quote!(#lifetime)
} else {
quote!(core::marker::Send + #lifetime)
quote!(::core::marker::Send + #lifetime)
};

sig.output = parse_quote! {
-> core::pin::Pin<Box<
dyn core::future::Future<Output = #ret> + #bounds
-> ::core::pin::Pin<Box<
dyn ::core::future::Future<Output = #ret> + #bounds
>>
};
}
Expand Down Expand Up @@ -317,8 +317,8 @@ fn transform_block(
match context {
Context::Trait { .. } => {
self_bound = Some(match mutability {
Some(_) => parse_quote!(core::marker::Send),
None => parse_quote!(core::marker::Sync),
Some(_) => parse_quote!(::core::marker::Send),
None => parse_quote!(::core::marker::Sync),
});
*arg = parse_quote! {
#under_self: &#lifetime #mutability AsyncTrait
Expand All @@ -343,7 +343,7 @@ fn transform_block(
let under_self = Ident::new("_self", self_token.span);
match context {
Context::Trait { .. } => {
self_bound = Some(parse_quote!(core::marker::Send));
self_bound = Some(parse_quote!(::core::marker::Send));
*arg = parse_quote! {
#mutability #under_self: AsyncTrait
};
Expand Down
3 changes: 3 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use async_trait::async_trait;

pub mod executor;

// Dummy module to check that the expansion refer to rust's core crate
mod core {}

#[async_trait]
trait Trait {
type Assoc;
Expand Down

0 comments on commit a0cc8c2

Please sign in to comment.