Why are where clauses on traits not propagated?

I have the following playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=85ce101ed846b05b89f62e0b2271596d Intuitively, I expect where clauses in traits to be propagated to places where the trait is used as a bound, since every implementation of the trait is required to fulfil these bounds. Is there a reason this is not done?

It’s a long-standing bug:

3 Likes

It is covered by the implied bounds proposal (RFC: https://github.com/rust-lang/rfcs/pull/2089), and is in the process of being implemented.

3 Likes

I thought it’s intentional, with some hidden cause behind it. Thanks for informing me!

I’d guess it was easier initially. There’s also a general intent for locality of information, where you could see all the required bounds locally.

The RFC explains more, but that’s the general gist of it. I’m glad to see the RFC accepted (I somehow missed it when it was accepted).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.