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.
This commit is contained in:
@@ -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")]
|
||||
|
||||
Reference in New Issue
Block a user