Yet another half-baked idea for working around the orphan rule
Rust Internals [Unofficial]
March 31, 2026
Some usage examples would really help me understand the proposal. Especially, it is not clear to me whether this addresses the main place where I tend to trip over the orphan rule:
// in a binary crate; `unix_path` and `rustix` are external libraries
use unix_path::Path; // a concrete type
use rustix::path::Arg; // a trait
// I'm not allowed to do this:
impl Arg for Path { /* ... */ }
// which means I have to have wrappers like this instead:
pub(crate) fn open_fd(path: &Path)
-> Result<rustix::fd::OwnedFd, MyError> {
rustix::fs::open(
path.as_unix_str().as_bytes(), // <-- blech
O_RDONLY, M_IGNORED
)
.map_err(Into::into)
}
What I want out of improvements to the orphan rule is a way to pass unix_path::Path objects directly to rustix::fs::open (and other APIs that take arguments with trait bound rustix::path::Arg) with no extra ceremony at each callsite. Does your proposal give us that?
(See my post in this older thread for more detail.)
Discussion in the ATmosphere