Skip to content

Commit a0cc8c2

Browse files
authored
Merge pull request #41 from Marwes/core
fix: Always refer to the core crate
2 parents 4cc7d23 + 57b3652 commit a0cc8c2

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/expand.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn transform_sig(
194194
where_clause.predicates.push(if assume_bound || is_local {
195195
parse_quote!(Self: #lifetime)
196196
} else {
197-
parse_quote!(Self: core::marker::#bound + #lifetime)
197+
parse_quote!(Self: ::core::marker::#bound + #lifetime)
198198
});
199199
}
200200
} else {
@@ -222,12 +222,12 @@ fn transform_sig(
222222
let bounds = if is_local {
223223
quote!(#lifetime)
224224
} else {
225-
quote!(core::marker::Send + #lifetime)
225+
quote!(::core::marker::Send + #lifetime)
226226
};
227227

228228
sig.output = parse_quote! {
229-
-> core::pin::Pin<Box<
230-
dyn core::future::Future<Output = #ret> + #bounds
229+
-> ::core::pin::Pin<Box<
230+
dyn ::core::future::Future<Output = #ret> + #bounds
231231
>>
232232
};
233233
}
@@ -317,8 +317,8 @@ fn transform_block(
317317
match context {
318318
Context::Trait { .. } => {
319319
self_bound = Some(match mutability {
320-
Some(_) => parse_quote!(core::marker::Send),
321-
None => parse_quote!(core::marker::Sync),
320+
Some(_) => parse_quote!(::core::marker::Send),
321+
None => parse_quote!(::core::marker::Sync),
322322
});
323323
*arg = parse_quote! {
324324
#under_self: &#lifetime #mutability AsyncTrait
@@ -343,7 +343,7 @@ fn transform_block(
343343
let under_self = Ident::new("_self", self_token.span);
344344
match context {
345345
Context::Trait { .. } => {
346-
self_bound = Some(parse_quote!(core::marker::Send));
346+
self_bound = Some(parse_quote!(::core::marker::Send));
347347
*arg = parse_quote! {
348348
#mutability #under_self: AsyncTrait
349349
};

tests/test.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use async_trait::async_trait;
44

55
pub mod executor;
66

7+
// Dummy module to check that the expansion refer to rust's core crate
8+
mod core {}
9+
710
#[async_trait]
811
trait Trait {
912
type Assoc;

0 commit comments

Comments
 (0)