Skip to content

Commit 9eb0a5c

Browse files
compiler-errorsgitbot
authored and
gitbot
committed
Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators
1 parent 44b4369 commit 9eb0a5c

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

core/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ pub mod random;
354354
pub mod range;
355355
pub mod result;
356356
pub mod sync;
357+
#[unstable(feature = "unsafe_binders", issue = "130516")]
358+
pub mod unsafe_binder;
357359

358360
pub mod fmt;
359361
pub mod hash;

core/src/unsafe_binder.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! Operators used to turn types into unsafe binders and back.
2+
3+
/// Unwrap an unsafe binder into its underlying type.
4+
#[allow_internal_unstable(builtin_syntax)]
5+
#[unstable(feature = "unsafe_binders", issue = "130516")]
6+
pub macro unwrap_binder {
7+
($expr:expr) => {
8+
builtin # unwrap_binder ( $expr )
9+
},
10+
($expr:expr ; $ty:ty) => {
11+
builtin # unwrap_binder ( $expr, $ty )
12+
},
13+
}
14+
15+
/// Wrap a type into an unsafe binder.
16+
#[allow_internal_unstable(builtin_syntax)]
17+
#[unstable(feature = "unsafe_binders", issue = "130516")]
18+
pub macro wrap_binder {
19+
($expr:expr) => {
20+
builtin # wrap_binder ( $expr )
21+
},
22+
($expr:expr ; $ty:ty) => {
23+
builtin # wrap_binder ( $expr, $ty )
24+
},
25+
}

std/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ pub use core::u64;
544544
#[stable(feature = "i128", since = "1.26.0")]
545545
#[allow(deprecated, deprecated_in_future)]
546546
pub use core::u128;
547+
#[unstable(feature = "unsafe_binders", issue = "130516")]
548+
pub use core::unsafe_binder;
547549
#[stable(feature = "rust1", since = "1.0.0")]
548550
#[allow(deprecated, deprecated_in_future)]
549551
pub use core::usize;

0 commit comments

Comments
 (0)