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 mock generic traits with 'static type parameters #51

Closed
asomers opened this issue Jul 4, 2019 · 1 comment
Closed

Can't mock generic traits with 'static type parameters #51

asomers opened this issue Jul 4, 2019 · 1 comment

Comments

@asomers
Copy link
Contributor

asomers commented Jul 4, 2019

With 0.20.0 Mockers can mock generic traits. However, mocking traits with 'static lifetime parameters doesn't work. Example:

        #[mocked]
        pub trait A<T: 'static> {
            fn foo(&self, t: T);
        }
error[E0310]: the parameter type `T` may not live long enough
   --> src/t_mockers.rs:205:9
    |
205 |         #[mocked]
    |         ^^^^^^^^^
206 |         pub trait A<T: 'static> {
    |                     -- help: consider adding an explicit lifetime bound `T: 'static`...
    |
note: ...so that the type `T` will meet its required lifetime bounds
   --> src/t_mockers.rs:205:9
    |
205 |         #[mocked]
    |         ^^^^^^^^^

error: aborting due to previous error
@kriomant
Copy link
Owner

kriomant commented Jul 6, 2019

I'm looking into it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants