{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiawvncftepa3ybjwlsadzdbwgcyprs6cbmfphss7j6u2hllh7qda4",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mmu77z43dk72"
},
"path": "/t/pre-rfc-unsafe-traits-conditionally-depending-on-safe-trait-behaviour/24360#post_5",
"publishedAt": "2026-05-27T16:50:52.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "CAD97:\n\n> Imo, having e.g. `#[marker] unsafe trait UseAllocator: Allocator + Clone` to mark clones that correctly share the allocator is honestly reasonable. It's a difference between `#[unsafe(satisfies_preconditions(Allocator))]` on the `Clone` impl (which now can't be derived) or an `unsafe impl` for `UseAllocator`. The former doesn't seem much better than the latter to justify the new mechanism for marking impls as fulfilling safety guarantees.\n\nWe have an existing way of expressing this kind of contract. Given that the `Clone` and `Allocator` impls for a type can come about completely independently via generic impls involving other traits defined in independent crates, I don't see how we can reasonably check in a local way that all involved `Clone` impls have the needed attribute.\n\nMaybe we should have nicer syntax to define and use such traits, but they do look like fundamentally the right mechanism to me.",
"title": "Pre-RFC: Unsafe traits conditionally depending on safe trait behaviour"
}