about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorAapo Alasuutari <aapo.alasuutari@gmail.com>2025-08-29 23:29:46 +0300
committerAapo Alasuutari <aapo.alasuutari@gmail.com>2025-09-15 20:23:26 +0300
commitc8663eec6a667ae6e7571297cb15192425311c33 (patch)
treef7da2335268880cd2383948f70991481c7c2ae40 /library/core/src
parentf3fd3efe4f698ad9dc2ccd6b46a3b07e1bc911da (diff)
downloadrust-c8663eec6a667ae6e7571297cb15192425311c33.tar.gz
rust-c8663eec6a667ae6e7571297cb15192425311c33.zip
Introduce CoerceShared lang item and trait
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/marker.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index d03d7a43469..8541a5b91cd 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -1372,3 +1372,12 @@ pub trait CoercePointeeValidated {
 pub trait Reborrow {
     // Empty.
 }
+
+/// Allows reborrowable value to be reborrowed as shared, creating a copy of
+/// that disables the source for writes for the lifetime of the copy.
+#[lang = "coerce_shared"]
+#[unstable(feature = "reborrow", issue = "145612")]
+pub trait CoerceShared: Reborrow {
+    /// The type of this value when reborrowed as shared.
+    type Target: Copy;
+}