diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-05-18 18:44:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-18 18:44:11 +0200 |
| commit | 4e5b1aa055aa0a0003a0ab81fa3efef495a0c0c6 (patch) | |
| tree | 8ac85f354e11b44a29ccc0fc0c57b37af7459388 /compiler/rustc_ast/src/ast.rs | |
| parent | 6f415e0f4c547c40490d1eeac971bd7b1057ac23 (diff) | |
| parent | f0b8ec1d71f055cbdb741565eaddabc93bf1ae75 (diff) | |
| download | rust-4e5b1aa055aa0a0003a0ab81fa3efef495a0c0c6.tar.gz rust-4e5b1aa055aa0a0003a0ab81fa3efef495a0c0c6.zip | |
Rollup merge of #140746 - dianne:guard-pat-res, r=oli-obk
name resolution for guard patterns This PR provides an initial implementation of name resolution for guard patterns [(RFC 3637)](https://github.com/rust-lang/rfcs/blob/master/text/3637-guard-patterns.md). This does not change the requirement that the bindings on either side of an or-pattern must be the same [(proposal here)](https://github.com/rust-lang/rfcs/blob/master/text/3637-guard-patterns.md#allowing-mismatching-bindings-when-possible); the code that handles that is separate from what this PR touches, so I'm saving it for a follow-up. On a technical level, this separates "collecting the bindings in a pattern" (which was already done for or-patterns) from "introducing those bindings into scope". I believe the approach used here can be extended straightforwardly in the future to work with `if let` guard patterns, but I haven't tried it myself since we don't allow those yet. Tracking issue for guard patterns: #129967 cc ``@Nadrieril``
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 4ace80a7344..a16219361c0 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -610,7 +610,7 @@ impl Pat { /// Walk top-down and call `it` in each place where a pattern occurs /// starting with the root pattern `walk` is called on. If `it` returns /// false then we will descend no further but siblings will be processed. - pub fn walk(&self, it: &mut impl FnMut(&Pat) -> bool) { + pub fn walk<'ast>(&'ast self, it: &mut impl FnMut(&'ast Pat) -> bool) { if !it(self) { return; } |
