about summary refs log tree commit diff
path: root/library/core/src/macros/mod.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-20 16:53:50 -0400
committerMichael Goulet <michael@errs.io>2024-03-21 11:42:49 -0400
commit2d633317f30dd02895f167b65dc1feeee0d08265 (patch)
tree50b3622db66615853ae53baa9c54d968f01e413b /library/core/src/macros/mod.rs
parent2627e9f3012a97d3136b3e11bf6bd0853c38a534 (diff)
downloadrust-2d633317f30dd02895f167b65dc1feeee0d08265.tar.gz
rust-2d633317f30dd02895f167b65dc1feeee0d08265.zip
Implement macro-based deref!() syntax for deref patterns
Stop using `box PAT` syntax for deref patterns, as it's misleading and
also causes their semantics being tangled up.
Diffstat (limited to 'library/core/src/macros/mod.rs')
-rw-r--r--library/core/src/macros/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index ebcaa626bd3..a78842c8f8d 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -1714,6 +1714,18 @@ pub(crate) mod builtin {
         builtin # type_ascribe($expr, $ty)
     }
 
+    #[cfg(not(bootstrap))]
+    /// Unstable placeholder for deref patterns.
+    #[allow_internal_unstable(builtin_syntax)]
+    #[unstable(
+        feature = "deref_patterns",
+        issue = "87121",
+        reason = "placeholder syntax for deref patterns"
+    )]
+    pub macro deref($pat:pat) {
+        builtin # deref($pat)
+    }
+
     /// Unstable implementation detail of the `rustc` compiler, do not use.
     #[rustc_builtin_macro]
     #[stable(feature = "rust1", since = "1.0.0")]