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
Rust prevents you from negative reasoning on foreign traits/types for forwards compatibility. A few types/traits are allowed to break this rule for ergonomic reasons, the trade-off being that implementing a trait for a fundamental type is a breaking change.
-
-
yeah I'm starting to get the intersection of this problem and logic programming and why so much of the material on this topic is "we can't do negative reasoning"
-
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
- 3 more replies
New conversation -
-
-
Fundemental on types ignore certain coherence rules. &T is local if T is local. Similarly fundamental traits let you rely on a foreign type not implementing that trait
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
yeah I've found the sources for &, &mut, Box and Fn being fundamental and what that actually means :)
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.