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:
parent
2627e9f301
commit
2d633317f3
31 changed files with 123 additions and 35 deletions
|
@ -621,7 +621,9 @@ impl Pat {
|
|||
| PatKind::Or(s) => s.iter().for_each(|p| p.walk(it)),
|
||||
|
||||
// Trivial wrappers over inner patterns.
|
||||
PatKind::Box(s) | PatKind::Ref(s, _) | PatKind::Paren(s) => s.walk(it),
|
||||
PatKind::Box(s) | PatKind::Deref(s) | PatKind::Ref(s, _) | PatKind::Paren(s) => {
|
||||
s.walk(it)
|
||||
}
|
||||
|
||||
// These patterns do not contain subpatterns, skip.
|
||||
PatKind::Wild
|
||||
|
@ -792,6 +794,9 @@ pub enum PatKind {
|
|||
/// A `box` pattern.
|
||||
Box(P<Pat>),
|
||||
|
||||
/// A `deref` pattern (currently `deref!()` macro-based syntax).
|
||||
Deref(P<Pat>),
|
||||
|
||||
/// A reference pattern (e.g., `&mut (a, b)`).
|
||||
Ref(P<Pat>, Mutability),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue