Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[instrument] compatibility #253

Closed
asomers opened this issue Feb 11, 2021 · 0 comments · Fixed by #256
Closed

#[instrument] compatibility #253

asomers opened this issue Feb 11, 2021 · 0 comments · Fixed by #256
Labels
enhancement New feature or request

Comments

@asomers
Copy link
Owner

asomers commented Feb 11, 2021

The tracing crate provides a proc macro named #[instrument]. #[automock] currently fails to compile for structs or traits that contain such a method. For example, this will fail to compile:

use mockall::*;
use tracing::instrument;

#[automock]
pub trait Foo {
    #[instrument]
    fn foo(&self) -> u32;
}
@asomers asomers added the enhancement New feature or request label Feb 11, 2021
asomers added a commit that referenced this issue Feb 13, 2021
The mock method won't be instrumented, but at least it will compile.

Fixes #253
asomers added a commit that referenced this issue Feb 13, 2021
The mock method won't be instrumented, but at least it will compile.

Fixes #253
asomers added a commit that referenced this issue Feb 13, 2021
The mock method won't be instrumented, but at least it will compile.

Fixes #253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant