From 8f5a28e0aa3a84aa105c66acec58684a2550b73a Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Fri, 29 Mar 2024 03:24:02 +0000 Subject: Require Pointee::Metadata to be Freeze So pointee metadata can be used in anonymous statics. This is prerequisite for implementing ThinBox without allocation for ZST. See https://github.com/rust-lang/rust/pull/123184#discussion_r1544627488 --- library/core/src/ptr/metadata.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'library/core/src') diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index 9b5da935e07..25a06f121cd 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -2,6 +2,7 @@ use crate::fmt; use crate::hash::{Hash, Hasher}; +use crate::marker::Freeze; /// Provides the pointer metadata type of any pointed-to type. /// @@ -57,7 +58,7 @@ pub trait Pointee { // NOTE: Keep trait bounds in `static_assert_expected_bounds_for_metadata` // in `library/core/src/ptr/metadata.rs` // in sync with those here: - type Metadata: fmt::Debug + Copy + Send + Sync + Ord + Hash + Unpin; + type Metadata: fmt::Debug + Copy + Send + Sync + Ord + Hash + Unpin + Freeze; } /// Pointers to types implementing this trait alias are “thin”. -- cgit 1.4.1-3-g733a5