Why are where clauses on traits not propagated?


#1

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?


#2

It’s a long-standing bug:


#3

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.


#4

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


#5

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).