mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00
attributes: change order of async and unsafe modifier (#2864)
When using `#[tracing::instrument]` and the `async unsafe` modifiers the generated function read `unsafe async fn`, which is wrong. Corrected the order and added a test. Fixes: #2576 Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
This commit is contained in:
parent
c6bedbe272
commit
0e4a4bef5e
@ -92,7 +92,7 @@ pub(crate) fn gen_function<'a, B: ToTokens + 'a>(
|
|||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
#(#outer_attrs) *
|
#(#outer_attrs) *
|
||||||
#vis #constness #unsafety #asyncness #abi fn #ident<#gen_params>(#params) #output
|
#vis #constness #asyncness #unsafety #abi fn #ident<#gen_params>(#params) #output
|
||||||
#where_clause
|
#where_clause
|
||||||
{
|
{
|
||||||
#(#inner_attrs) *
|
#(#inner_attrs) *
|
||||||
|
@ -31,6 +31,9 @@ async fn test_ret_impl_trait_err(n: i32) -> Result<impl Iterator<Item = i32>, &'
|
|||||||
#[instrument]
|
#[instrument]
|
||||||
async fn test_async_fn_empty() {}
|
async fn test_async_fn_empty() {}
|
||||||
|
|
||||||
|
#[instrument]
|
||||||
|
async unsafe fn test_async_unsafe_fn_empty() {}
|
||||||
|
|
||||||
// Reproduces a compile error when an instrumented function body contains inner
|
// Reproduces a compile error when an instrumented function body contains inner
|
||||||
// attributes (https://github.com/tokio-rs/tracing/issues/2294).
|
// attributes (https://github.com/tokio-rs/tracing/issues/2294).
|
||||||
#[deny(unused_variables)]
|
#[deny(unused_variables)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user