diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-13 14:00:10 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-12-12 16:29:40 +0000 |
| commit | 3f97c6be8d4b78c9df55804171c588ebfadcb63e (patch) | |
| tree | cdf10693da1f8085020f11bf6051d3b6747b6386 /library | |
| parent | 2a9e358c723b03cc6adbce9c2c5af36cb2d83914 (diff) | |
| download | rust-3f97c6be8d4b78c9df55804171c588ebfadcb63e.tar.gz rust-3f97c6be8d4b78c9df55804171c588ebfadcb63e.zip | |
Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators
Diffstat (limited to 'library')
| -rw-r--r-- | library/core/src/lib.rs | 2 | ||||
| -rw-r--r-- | library/core/src/unsafe_binder.rs | 25 | ||||
| -rw-r--r-- | library/std/src/lib.rs | 2 |
3 files changed, 29 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 ) + }, +} diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 047f5b0c4c5..1cbf51463ea 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -544,6 +544,8 @@ pub use core::u64; #[stable(feature = "i128", since = "1.26.0")] #[allow(deprecated, deprecated_in_future)] pub use core::u128; +#[unstable(feature = "unsafe_binders", issue = "130516")] +pub use core::unsafe_binder; #[stable(feature = "rust1", since = "1.0.0")] #[allow(deprecated, deprecated_in_future)] pub use core::usize; |
