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
// rustix::fs::open's signature is something like
// fn open<T: Arg>(path: T) -> Result<rustix::fd::OwnedFd, rustix::Error>;
//
// neither library provides this impl and I'm not allowed to do it:
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.)