about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_mir_build/src/builder/matches/mod.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs
index a2995c04727..a2f92a93ec5 100644
--- a/compiler/rustc_mir_build/src/builder/matches/mod.rs
+++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs
@@ -362,11 +362,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
         let scrutinee_place =
             unpack!(block = self.lower_scrutinee(block, scrutinee_id, scrutinee_span));
 
-        let arms = arms.iter().map(|arm| &self.thir[*arm]);
         let match_start_span = span.shrink_to_lo().to(scrutinee_span);
         let patterns = arms
-            .clone()
-            .map(|arm| {
+            .iter()
+            .map(|&arm| {
+                let arm = &self.thir[arm];
                 let has_match_guard =
                     if arm.guard.is_some() { HasMatchGuard::Yes } else { HasMatchGuard::No };
                 (&*arm.pattern, has_match_guard)
@@ -413,20 +413,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
     /// (by [Builder::lower_match_tree]).
     ///
     /// `outer_source_info` is the SourceInfo for the whole match.
-    fn lower_match_arms<'pat>(
+    fn lower_match_arms(
         &mut self,
         destination: Place<'tcx>,
         scrutinee_place_builder: PlaceBuilder<'tcx>,
         scrutinee_span: Span,
-        arms: impl IntoIterator<Item = &'pat Arm<'tcx>>,
+        arms: &[ArmId],
         built_match_tree: BuiltMatchTree<'tcx>,
         outer_source_info: SourceInfo,
-    ) -> BlockAnd<()>
-    where
-        'tcx: 'pat,
-    {
+    ) -> BlockAnd<()> {
         let arm_end_blocks: Vec<BasicBlock> = arms
-            .into_iter()
+            .iter()
+            .map(|&arm| &self.thir[arm])
             .zip(built_match_tree.branches)
             .map(|(arm, branch)| {
                 debug!("lowering arm {:?}\ncorresponding branch = {:?}", arm, branch);