Rollup merge of #123268 - RalfJung:dont-freeze, r=Nilstrieb

warn against implementing Freeze

As [requested](https://github.com/rust-lang/rust/pull/123184#issuecomment-2028531388) by `@workingjubilee`
This commit is contained in:
Jubilee 2024-03-31 13:18:17 -07:00 committed by GitHub
commit 9ff4c70476
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -817,6 +817,13 @@ pub trait DiscriminantKind {
/// This can be used to declare that a constant with a generic type
/// will not contain interior mutability, and subsequently allow
/// placing the constant behind references.
///
/// # Safety
///
/// This trait is a core part of the language, it is just expressed as a trait in libcore for
/// convenience. Do *not* implement it for other types.
// FIXME: Eventually this trait should become `#[rustc_deny_explicit_impl]`.
// That requires porting the impls below to native internal impls.
#[lang = "freeze"]
#[unstable(feature = "freeze", issue = "121675")]
pub unsafe auto trait Freeze {}