{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreihxfi73o4fhdloancjgkc7hu4wnfjv7omc3qkbjf7f4dcgehmmaty",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mien4pwsu4i2"
},
"path": "/t/yet-another-half-baked-idea-for-working-around-the-orphan-rule/24121#post_4",
"publishedAt": "2026-03-31T12:36:20.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"my post in this older thread"
],
"textContent": "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:\n\n\n // in a binary crate; `unix_path` and `rustix` are external libraries\n use unix_path::Path; // a concrete type\n use rustix::path::Arg; // a trait\n\n // I'm not allowed to do this:\n impl Arg for Path { /* ... */ }\n\n // which means I have to have wrappers like this instead:\n pub(crate) fn open_fd(path: &Path)\n -> Result<rustix::fd::OwnedFd, MyError> {\n rustix::fs::open(\n path.as_unix_str().as_bytes(), // <-- blech\n O_RDONLY, M_IGNORED\n )\n .map_err(Into::into)\n }\n\n\nWhat 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?\n\n(See my post in this older thread for more detail.)",
"title": "Yet another half-baked idea for working around the orphan rule"
}