Extract for_each_immediate_subpat from THIR pattern visitors by Zalathar · Pull Request #138635 · rust-lang/rust (original) (raw)

This is extracted from some larger changes I've been working on, trying to introduce a “THIR pattern id” to refer to THIR pattern nodes without a direct reference.

The future of those changes is somewhat uncertain, due to some proposed changes involving upvar inference. So I'm taking my preparatory changes that make sense on their own, and extracting them into one or more independent PRs.


This particular patch takes two different functions that were both matching on PatKind to traverse subpatterns, and extracts the core match into a single helper function.