about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-31 12:46:37 +0200
committerRalf Jung <post@ralfj.de>2024-03-31 22:15:48 +0200
commit602401c4d49753dfd9d351ffcf0c72c00ff4c62f (patch)
tree033b172d451b7d8e2e7c18e9de6427a86c6d5e18
parentc93b17d6d20a234f21e04804adef7b58a08dd9e4 (diff)
downloadrust-602401c4d49753dfd9d351ffcf0c72c00ff4c62f.tar.gz
rust-602401c4d49753dfd9d351ffcf0c72c00ff4c62f.zip
warn against implementing Freeze
-rw-r--r--library/core/src/marker.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 385c288db12..1d073a6d649 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -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 {}