about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-13 14:00:10 -0400
committerMichael Goulet <michael@errs.io>2024-12-12 16:29:40 +0000
commit3f97c6be8d4b78c9df55804171c588ebfadcb63e (patch)
treecdf10693da1f8085020f11bf6051d3b6747b6386 /library/core/src
parent2a9e358c723b03cc6adbce9c2c5af36cb2d83914 (diff)
downloadrust-3f97c6be8d4b78c9df55804171c588ebfadcb63e.tar.gz
rust-3f97c6be8d4b78c9df55804171c588ebfadcb63e.zip
Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/lib.rs2
-rw-r--r--library/core/src/unsafe_binder.rs25
2 files changed, 27 insertions, 0 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index fde6887c5ab..d45cb01910f 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -354,6 +354,8 @@ pub mod random;
 pub mod range;
 pub mod result;
 pub mod sync;
+#[unstable(feature = "unsafe_binders", issue = "130516")]
+pub mod unsafe_binder;
 
 pub mod fmt;
 pub mod hash;
diff --git a/library/core/src/unsafe_binder.rs b/library/core/src/unsafe_binder.rs
new file mode 100644
index 00000000000..98f53e07d9d
--- /dev/null
+++ b/library/core/src/unsafe_binder.rs
@@ -0,0 +1,25 @@
+//! Operators used to turn types into unsafe binders and back.
+
+/// Unwrap an unsafe binder into its underlying type.
+#[allow_internal_unstable(builtin_syntax)]
+#[unstable(feature = "unsafe_binders", issue = "130516")]
+pub macro unwrap_binder {
+    ($expr:expr) => {
+        builtin # unwrap_binder ( $expr )
+    },
+    ($expr:expr ; $ty:ty) => {
+        builtin # unwrap_binder ( $expr, $ty )
+    },
+}
+
+/// Wrap a type into an unsafe binder.
+#[allow_internal_unstable(builtin_syntax)]
+#[unstable(feature = "unsafe_binders", issue = "130516")]
+pub macro wrap_binder {
+    ($expr:expr) => {
+        builtin # wrap_binder ( $expr )
+    },
+    ($expr:expr ; $ty:ty) => {
+        builtin # wrap_binder ( $expr, $ty )
+    },
+}