about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-03-31 13:18:17 -0700
committerGitHub <noreply@github.com>2024-03-31 13:18:17 -0700
commit9ff4c704763733e5711a0bdf8bb509b0bccf5fee (patch)
treecc21eb9d9c243c18ba54ba9c04fe8b9470e03901
parent2a08f020489416086d39f03e91236aaa66e94507 (diff)
parent602401c4d49753dfd9d351ffcf0c72c00ff4c62f (diff)
downloadrust-9ff4c704763733e5711a0bdf8bb509b0bccf5fee.tar.gz
rust-9ff4c704763733e5711a0bdf8bb509b0bccf5fee.zip
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`
-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 {}