Hacker News new | ask | show | jobs
by direwolf20 140 days ago
How does it handle an implementation of a trait being in scope in one compilation unit and out of scope in another? That's the wicked problem.
1 comments

It’s impossible (?) due to the “coherence” rule. A type A can implement a trait B in two places: the crate where A is defined or the crate where B is defined. So if you can see A and B, you know definitely whether A implements B.

The actual rule is more complex due to generics:

https://github.com/rust-lang/rfcs/blob/master/text/2451-re-r...

and that document doesn’t actually seem to think that this particular property is critical.