Skip to content

Commit

Permalink
fix: try to repair messages with incorrect bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
evertedsphere committed Apr 12, 2023
1 parent 6dcaecc commit e10ffa2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tokio-macros/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ fn parse_knobs(mut input: syn::ItemFn, is_test: bool, config: FinalConfig) -> To
input.sig.asyncness = None;

// If type mismatch occurs, the current rustc points to the last statement.
let (last_stmt_start_span, _last_stmt_end_span) = {
let (last_stmt_start_span, last_stmt_end_span) = {
let mut last_stmt = input
.block
.stmts
Expand Down Expand Up @@ -375,7 +375,9 @@ fn parse_knobs(mut input: syn::ItemFn, is_test: bool, config: FinalConfig) -> To

let body = &input.block;
let brace_token = input.block.brace_token;
let body_ident = quote! { body };
let body_ident = quote_spanned! {last_stmt_end_span=>
body
};
let block_expr = quote_spanned! {Span::call_site()=>
#[allow(clippy::expect_used, clippy::diverging_sub_expression)]
{
Expand Down

0 comments on commit e10ffa2

Please sign in to comment.