File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,22 @@ fn transform_block(
412412 Box :: pin( #inner:: <#( #types) , * >( #( #args) , * ) )
413413 } ) ;
414414
415+ // Make the span `Box::pin` be that of the block so that "Send is not implemented" errors point
416+ // to the block and no the `#[async_trait]` attribute
417+ if let Some ( syn:: Stmt :: Expr ( syn:: Expr :: Call ( box_pin) ) ) = block. stmts . last_mut ( ) {
418+ struct ReplaceSpan ( Span ) ;
419+ impl VisitMut for ReplaceSpan {
420+ fn visit_span_mut ( & mut self , span : & mut Span ) {
421+ * span = self . 0
422+ }
423+ }
424+ let mut replace_span = ReplaceSpan ( brace. span ) ;
425+ replace_span. visit_expr_mut ( & mut box_pin. func ) ;
426+ box_pin. paren_token . span = brace. span ;
427+ } else {
428+ unreachable ! ( )
429+ }
430+
415431 block. brace_token = brace;
416432}
417433
You can’t perform that action at this time.
0 commit comments