@@ -47,32 +47,16 @@ pub fn expand(input: &mut Item, is_local: bool) {
47
47
} ;
48
48
for inner in & mut input. items {
49
49
if let TraitItem :: Method ( method) = inner {
50
- <<<<<<< HEAD
51
50
let sig = & mut method. sig ;
52
51
if sig. asyncness . is_some ( ) {
53
52
let block = & mut method. default ;
54
53
let mut has_self = has_self_in_sig ( sig) ;
55
54
if let Some ( block) = block {
56
55
has_self |= has_self_in_block ( block) ;
57
- transform_block ( context , sig , block , has_self ) ;
58
- ||||||| merged common ancestors
59
- if method. sig. asyncness. is_some ( ) {
60
- if let Some ( block ) = & mut method. default {
61
- transform_block ( context , & method . sig, block ) ;
62
- =======
63
- if method. sig. asyncness. is_some ( ) {
64
- if let Some ( block ) = & mut method. default {
65
- transform_block ( context , & method . sig, block , is_local ) ;
66
- >>>>>>> pr/10
56
+ transform_block ( context, sig, block, has_self, is_local) ;
67
57
}
68
58
let has_default = method. default . is_some ( ) ;
69
- <<<<<<< HEAD
70
- transform_sig ( context , sig , has_self , has_default ) ;
71
- ||||||| merged common ancestors
72
- transform_sig ( context , & mut method . sig, has_default ) ;
73
- =======
74
- transform_sig ( context , & mut method . sig, has_default , is_local ) ;
75
- >>>>>>> pr/10
59
+ transform_sig ( context, sig, has_self, has_default, is_local) ;
76
60
}
77
61
}
78
62
}
@@ -85,22 +69,12 @@ pub fn expand(input: &mut Item, is_local: bool) {
85
69
} ;
86
70
for inner in & mut input. items {
87
71
if let ImplItem :: Method ( method) = inner {
88
- <<<<<<< HEAD
89
72
let sig = & mut method. sig ;
90
73
if sig. asyncness . is_some ( ) {
91
74
let block = & mut method. block ;
92
75
let has_self = has_self_in_sig ( sig) || has_self_in_block ( block) ;
93
- transform_block ( context , sig , block , has_self ) ;
94
- transform_sig( context , sig , has_self , false ) ;
95
- ||||||| merged common ancestors
96
- if method. sig. asyncness. is_some ( ) {
97
- transform_block( context, & method. sig, & mut method. block) ;
98
- transform_sig( context, & mut method. sig, false ) ;
99
- =======
100
- if method. sig. asyncness. is_some( ) {
101
- transform_block( context, & method. sig, & mut method. block, is_local) ;
102
- transform_sig( context, & mut method. sig, false , is_local) ;
103
- >>>>>>> pr/10
76
+ transform_block ( context, sig, block, has_self, is_local) ;
77
+ transform_sig ( context, sig, has_self, false , is_local) ;
104
78
}
105
79
}
106
80
}
@@ -121,13 +95,7 @@ pub fn expand(input: &mut Item, is_local: bool) {
121
95
// 'life1: 'async_trait,
122
96
// T: 'async_trait,
123
97
// Self: Sync + 'async_trait;
124
- < <<<<<< HEAD
125
- fn transform_sig( context : Context , sig : & mut MethodSig , has_self : bool , has_default : bool ) {
126
- ||||||| merged common ancestors
127
- fn transform_sig ( context : Context , sig : & mut MethodSig , has_default : bool ) {
128
- =======
129
- fn transform_sig ( context : Context , sig : & mut MethodSig , has_default : bool , is_local : bool ) {
130
- >>>>>>> pr/10
98
+ fn transform_sig ( context : Context , sig : & mut MethodSig , has_self : bool , has_default : bool , is_local : bool ) {
131
99
sig. decl . fn_token . span = sig. asyncness . take ( ) . unwrap ( ) . span ;
132
100
133
101
let ret = match & sig. decl . output {
@@ -244,13 +212,7 @@ fn transform_sig(context: Context, sig: &mut MethodSig, has_default: bool, is_lo
244
212
// _self + x
245
213
// }
246
214
// Pin::from(Box::new(async_trait_method::<T, Self>(self, x)))
247
- <<<<<<< HEAD
248
- fn transform_block( context: Context , sig : & mut MethodSig , block : & mut Block , has_self : bool ) {
249
- ||||||| merged common ancestors
250
- fn transform_block ( context : Context , sig : & MethodSig , block : & mut Block ) {
251
- =======
252
- fn transform_block ( context : Context , sig : & MethodSig , block : & mut Block , is_local : bool ) {
253
- >>>>>>> pr/10
215
+ fn transform_block ( context : Context , sig : & mut MethodSig , block : & mut Block , has_self : bool , is_local : bool ) {
254
216
let inner = Ident :: new ( & format ! ( "__{}" , sig. ident) , sig. ident . span ( ) ) ;
255
217
let args = sig
256
218
. decl
@@ -319,26 +281,6 @@ fn transform_block(context: Context, sig: &MethodSig, block: &mut Block, is_loca
319
281
* arg = parse_quote ! {
320
282
#under_self: & #lifetime #mutability AsyncTrait
321
283
} ;
322
- <<<<<<< HEAD
323
- ||||||| merged common ancestors
324
- let ( _ , generics , _ ) = generics. split_for_impl ( ) ;
325
- standalone. decl. generics. params. push ( parse_quote ! {
326
- AsyncTrait : ?Sized + #name #generics + core:: marker:: #bound
327
- } ) ;
328
- types. push( Ident :: new( "Self" , Span :: call_site( ) ) ) ;
329
- =======
330
- let ( _, generics, _) = generics. split_for_impl( ) ;
331
- if is_local {
332
- standalone. decl. generics. params. push( parse_quote ! {
333
- AsyncTrait : ?Sized + #name #generics
334
- } ) ;
335
- } else {
336
- standalone. decl. generics. params. push( parse_quote ! {
337
- AsyncTrait : ?Sized + #name #generics + core:: marker:: #bound
338
- } ) ;
339
- }
340
- types. push( Ident :: new( "Self" , Span :: call_site( ) ) ) ;
341
- >>>>>>> pr/10
342
284
}
343
285
Context :: Impl { receiver, .. } => {
344
286
* arg = parse_quote ! {
@@ -382,7 +324,9 @@ fn transform_block(context: Context, sig: &MethodSig, block: &mut Block, is_loca
382
324
if has_self {
383
325
let ( _, generics, _) = generics. split_for_impl ( ) ;
384
326
let mut self_param: TypeParam = parse_quote ! ( AsyncTrait : ?Sized + #name #generics) ;
385
- self_param. bounds. extend ( self_bound ) ;
327
+ if !is_local {
328
+ self_param. bounds . extend ( self_bound) ;
329
+ }
386
330
standalone
387
331
. decl
388
332
. generics
0 commit comments