-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
A-privacyPrivacy related proposals & ideasPrivacy related proposals & ideasA-traitsTrait system related proposals & ideasTrait system related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
Hi,
a lot of times you want to have a trait in your library/crate that can't be implemented by the library users.
either because it's a marker trait for FFI related things, related to a custom type system, or because it's very highly unsafe and weird.
libstd's solution to this problem is exposing pub traits but marking them unstable to implement i.e. https://doc.rust-lang.org/std/slice/trait.SliceIndex.html
I propose we add something like #[non_exhaustive]
but for traits, i.e. #[unimplementable]
we can already see similiar weird tricks in the wild, i.e.
https://docs.rs/zerocopy/0.2.8/src/zerocopy/lib.rs.html#207
https://github.com/rust-bitcoin/rust-secp256k1/blob/master/src/context.rs#L10
and more.
Metadata
Metadata
Assignees
Labels
A-privacyPrivacy related proposals & ideasPrivacy related proposals & ideasA-traitsTrait system related proposals & ideasTrait system related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.