Revisit Orphan Rules

I mentioned something like this in an incredibly spit-bally fashion here: Moving bits of rustc into crates - #35 by gbutler. I guess I could envision something like:

  • Declare "Friends" Crates in the Cargo.toml
  • Declare modules with "friend" visibility to "friend" crates in the main.rs/lib.rs
  • Possibly have a "friend" visibility specifier for items to allow items that are private to a module/struct to be visible to "friends" of the module??? Otherwise, private items become effectively public to friends if not.

This probably requires more thought. Obviously, this would change the compiler as symbols that were private to the crate (or those with "friend" visibility specifier) would now have to be exposed to "friends" but not "public".

Cargo and/or the compiler could possibly be taught to give warnings when changing "friend" visible items. Perhaps, Semver rules could be extended to say that any change to a "friend" visible item would require a minor version bump and that would be a breaking change for "friend" crates, but, not non-friend crates (or something like that).