Merge pull request #540 from petrochenkov/mishygiene

codegen: Fix hygiene mismatch between function `args` uses and definitions
This commit is contained in:
Stephen Chung 2022-03-18 13:59:26 +08:00 committed by GitHub
commit 87273c5421
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -774,14 +774,14 @@ impl ExportedFn {
syn::Type::Path(ref p) if p.path == string_type_path => {
is_string = true;
is_ref = false;
quote_spanned!(arg_type.span() =>
quote_spanned!(arg_type.span().resolved_at(Span::call_site()) =>
mem::take(args[#i]).into_string().unwrap()
)
}
_ => {
is_string = false;
is_ref = false;
quote_spanned!(arg_type.span() =>
quote_spanned!(arg_type.span().resolved_at(Span::call_site()) =>
mem::take(args[#i]).cast::<#arg_type>()
)
}