Seek and ye shall find: https://github.com/rust-lang/rfcs/issues/616
I wanted to highlight the above suggestion on how we might write tests against traits rather than just specific impls. Throwing out old school OO, Rust throws its full weight behind interfaces. Given that the standard library has a suite of tests around each trait what a gift it would be if we were able to leverage those tests on our own custom impls.
I’m arguing now is far better to talk about /implement this than in several years time as by then the ecosystem will be in place and ideally if we can do this for std traits, then we’d get even more benefit for the next levels up offering tests for free on their traits.
Let’s not reinvent the wheel when writing tests, let’s re-use existing tests where we can so we have more time to add specific interesting test cases.
I think a really interesting case is if we add a std test case on an existing trait, and suddenly downstream crates test suites break, are we breaking backward compatibility? I’d argue we’re just adding an additional lint that the impl is doing something non-standard, and as an implementer I’d be keen to find that out.
Is there prior art? I’ve not seen many attempt this which I find surprising.