File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -229,23 +229,27 @@ fn transform_sig(
229229 . push ( parse_quote_spanned ! ( default_span=> ' async_trait) ) ;
230230
231231 if has_self {
232- let bounds = match sig. inputs . iter ( ) . next ( ) {
232+ let bounds: & [ InferredBound ] = match sig. inputs . iter ( ) . next ( ) {
233233 Some ( FnArg :: Receiver ( Receiver {
234234 reference : Some ( _) ,
235235 mutability : None ,
236236 ..
237- } ) ) => [ InferredBound :: Sync ] ,
237+ } ) ) => & [ InferredBound :: Sync ] ,
238238 Some ( FnArg :: Typed ( arg) )
239- if match ( arg. pat . as_ref ( ) , arg. ty . as_ref ( ) ) {
240- ( Pat :: Ident ( pat) , Type :: Reference ( ty) ) => {
241- pat. ident == "self" && ty. mutability . is_none ( )
242- }
239+ if match arg. pat . as_ref ( ) {
240+ Pat :: Ident ( pat) => pat. ident == "self" ,
243241 _ => false ,
244242 } =>
245243 {
246- [ InferredBound :: Sync ]
244+ match arg. ty . as_ref ( ) {
245+ Type :: Reference ( ty) if ty. mutability . is_none ( ) => & [ InferredBound :: Sync ] ,
246+ Type :: Path ( ty) if ty. path . segments . last ( ) . unwrap ( ) . ident == "Arc" => {
247+ & [ InferredBound :: Sync , InferredBound :: Send ]
248+ }
249+ _ => & [ InferredBound :: Send ] ,
250+ }
247251 }
248- _ => [ InferredBound :: Send ] ,
252+ _ => & [ InferredBound :: Send ] ,
249253 } ;
250254
251255 let bounds = bounds. iter ( ) . filter_map ( |bound| {
You can’t perform that action at this time.
0 commit comments