In nightly compilers, it's now possible to return impl Trait in a trait method. Mockall needs nothing new to support this. The existing "deimplify" strategy, already used for inherent methods, works for trait methods too.
The generated code will still return Box<dyn Trait> instead of impl Trait. We can't easily change that because the generated code also includes things like Fn() -> impl Trait, and Rust does not yet allow "impl Trait" as a return type for closures. The generated code also includes things like Into<impl Trait>, which makes even less sense.
In nightly compilers, it's now possible to return
impl Trait
in a trait method. Mockall needs nothing new to support this. The existing "deimplify" strategy, already used for inherent methods, works for trait methods too.The generated code will still return
Box<dyn Trait>
instead ofimpl Trait
. We can't easily change that because the generated code also includes things likeFn() -> impl Trait
, and Rust does not yet allow "impl Trait" as a return type for closures. The generated code also includes things likeInto<impl Trait>
, which makes even less sense.https://rust-lang.github.io/rfcs/3425-return-position-impl-trait-in-traits.html