File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -307,21 +307,25 @@ fn transform_block(
307
307
}
308
308
}
309
309
Some ( arg @ FnArg :: Receiver ( _) ) => {
310
- let self_token = match arg {
311
- FnArg :: Receiver ( Receiver { self_token, .. } ) => self_token,
310
+ let ( self_token, mutability) = match arg {
311
+ FnArg :: Receiver ( Receiver {
312
+ self_token,
313
+ mutability,
314
+ ..
315
+ } ) => ( self_token, mutability) ,
312
316
_ => unreachable ! ( ) ,
313
317
} ;
314
318
let under_self = Ident :: new ( "_self" , self_token. span ) ;
315
319
match context {
316
320
Context :: Trait { .. } => {
317
321
self_bound = Some ( parse_quote ! ( core:: marker:: Send ) ) ;
318
322
* arg = parse_quote ! {
319
- #under_self: AsyncTrait
323
+ #mutability # under_self: AsyncTrait
320
324
} ;
321
325
}
322
326
Context :: Impl { receiver, .. } => {
323
327
* arg = parse_quote ! {
324
- #under_self: #receiver
328
+ #mutability # under_self: #receiver
325
329
} ;
326
330
}
327
331
}
Original file line number Diff line number Diff line change @@ -225,3 +225,31 @@ mod issue17 {
225
225
}
226
226
}
227
227
}
228
+
229
+ // https://github.com/dtolnay/async-trait/issues/23
230
+ mod issue23 {
231
+ use async_trait:: async_trait;
232
+
233
+ #[ async_trait]
234
+ pub trait T {
235
+ async fn f ( self ) ;
236
+
237
+ async fn g ( mut self )
238
+ where
239
+ Self : Sized ,
240
+ {
241
+ do_something ( & mut self ) ;
242
+ }
243
+ }
244
+
245
+ struct S { }
246
+
247
+ #[ async_trait]
248
+ impl T for S {
249
+ async fn f ( mut self ) {
250
+ do_something ( & mut self ) ;
251
+ }
252
+ }
253
+
254
+ fn do_something < T > ( _: & mut T ) { }
255
+ }
You can’t perform that action at this time.
0 commit comments