8000 Issues with lifetimes on methods with generics and mock! · Issue #652 · asomers/mockall · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Issues with lifetimes on methods with generics and mock! #652
Open
@andresmargalef

Description

@andresmargalef

I'm having some issues when mocking with lifetimes and generics.

This is the example:

struct S<'a> {
    arg: &'a str,
}

trait MyTrait {
    fn myfunc<'a, C: std::fmt::Debug + Send + Sync + 'static>(
        &self,
        arg: S<'a>,
        ctx: &C,
    );
}

mock! {
    MyStruct {}

    impl MyTrait for MyStruct {
        fn myfunc<'a, C: std::fmt::Debug + Send + Sync + 'static>(
            &self,
            arg: S<'a>,
            ctx: &C,
        );
    }
}

The error is:

Image

But if I simplify the trait, there is no error at all

trait MyTrait2 {
    fn myfunc<'a>(
        &self,
        arg: S<'a>,
    );
}

mock! {
    MyStruct2 {}

    impl MyTrait2 for MyStruct2 {
        fn myfunc<'a>(
            &self,
            arg: S<'a>,
        );
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0