is there a single document describing rust's coherence rules? googling gives various blog posts and RFCs but I'm struggling to find a single definition of this
The rebalancing coherence rfc lays out the reasoning pretty clearly. If we let you rely on ForeignType: !ForeignTrait, implementing any trait for any type would be a breaking change. So there's a balance chosen between permitting as much as possible while allowing lib evolution
-
-
this chimes with a common approach in type theory which is that adding new fields to records should be safe
-
Yeah, similar idea (though forwards compatibility is opt out instead of opt in here unlike with structs/enums). We're more restrictive than we need to be I think. Re-re-balancing coherence permitted a good bit more without changing the restrictions. I suspect more cases exist
- 1 more reply
New conversation -
-
-
In fact the error message you get in these cases should even way something like "foreign_crate may implement ForeignTrait for ForeignType in a future version"
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.