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

Can't automock struct when defining own type #73

Closed
ghost opened this issue Nov 13, 2019 · 0 comments · Fixed by #74
Closed

Can't automock struct when defining own type #73

ghost opened this issue Nov 13, 2019 · 0 comments · Fixed by #74
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Nov 13, 2019

I'm recently started using mockall and noticed if a custom result type is used the following code fails to compile:

type Result<T> = std::result::Result<T, String>;

struct MyStruct {}

#[automock]
impl MyStruct {
    fn ret_res() -> Result<String> {
        unimplemented!()
    }
}

cargo build output:

#[automock]
| ^^^^^^^^^^^ unexpected type argument

@asomers asomers added the bug Something isn't working label Nov 14, 2019
asomers added a commit that referenced this issue Nov 14, 2019
There was a hygiene violation in the proc macro.  It would cause
automock and mock to fail anytime a custom Result type was in scope,
even if the mocked method didn't try to use it.

Fixes #73
asomers added a commit that referenced this issue Nov 16, 2019
There was a hygiene violation in the proc macro.  It would cause
automock and mock to fail anytime a custom Result type was in scope,
even if the mocked method didn't try to use it.

Fixes #73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant