summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-08-01 20:49:52 +1000
committerZalathar <Zalathar@users.noreply.github.com>2024-08-07 20:52:46 +1000
commit7f48851416c0faf0333a23ba37904f4a407c723b (patch)
treeb4d7f9f2f459f4be78ced45befa1297bfdf357bc /compiler/rustc_pattern_analysis
parente98e19e49108b6e49e452c3bd22c1aeccd43e507 (diff)
downloadrust-7f48851416c0faf0333a23ba37904f4a407c723b.tar.gz
rust-7f48851416c0faf0333a23ba37904f4a407c723b.zip
Split out a `hoist` helper in `hoist_witness_pat`
Diffstat (limited to 'compiler/rustc_pattern_analysis')
-rw-r--r--compiler/rustc_pattern_analysis/src/rustc.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs
index f27c279912f..9fa5222452e 100644
--- a/compiler/rustc_pattern_analysis/src/rustc.rs
+++ b/compiler/rustc_pattern_analysis/src/rustc.rs
@@ -828,7 +828,8 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
         use print::{FieldPat, Pat, PatKind};
         let cx = self;
         let is_wildcard = |pat: &Pat<'_>| matches!(pat.kind, PatKind::Wild);
-        let mut subpatterns = pat.iter_fields().map(|p| Box::new(cx.hoist_witness_pat(p)));
+        let hoist = |p| Box::new(cx.hoist_witness_pat(p));
+        let mut subpatterns = pat.iter_fields().map(hoist);
         let kind = match pat.ctor() {
             Bool(b) => PatKind::Constant { value: mir::Const::from_bool(cx.tcx, *b) },
             IntRange(range) => return self.hoist_pat_range(range, *pat.ty()),