Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Trace be cross-crate compatible
This is a key and PRable part of the effort of refactoring the core out of the main crate to an auxiliar crate, imported by all the other levels: rune_core. To avoid the orphan rule (See RFC 1023 - rebalancing coherence) we can't implement foreign traits for foreign types. A plain example is us implementing `Deref` and `DerefMut` for the "future" foreign type `Rt`. As `Rt` (with the core refactor) would now be foreign, we fall into the orphan rule. We overcome that limitation by introducing a trait that would act as the foreign trait, but the key difference is that we are now implementing it on the actual type `T`, not the rooted type `Rt<T>`, as part of the `Trace` macro. When types now derive the `Trace` macro, we implement `RootedDeref` and whenever the rooted types need to access `deref` or `deref_mut`, they are able to do so, as we also implement blanket implementations below it, for all rooted types `Rt<T>`. All of this and more discussions are part of this issue: CeleritasCelery#42
- Loading branch information