]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/build/matches/test.rs
Auto merge of #52733 - pnkfelix:issue-51348-make-temp-for-each-candidate-in-arm,...
[rust.git] / src / librustc_mir / build / matches / test.rs
index aa5727ee5c7ea67d1cce0032568ac73bfd17e17f..afa0d28dd77180ebb6eef5e916cda5d9827d2939 100644 (file)
@@ -74,8 +74,8 @@ pub fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx> {
                 Test {
                     span: match_pair.pattern.span,
                     kind: TestKind::Range {
-                        lo: Literal::Value { value: lo },
-                        hi: Literal::Value { value: hi },
+                        lo,
+                        hi,
                         ty: match_pair.pattern.ty.clone(),
                         end,
                     },
@@ -149,7 +149,7 @@ pub fn add_cases_to_switch<'pat>(&mut self,
     pub fn add_variants_to_switch<'pat>(&mut self,
                                         test_place: &Place<'tcx>,
                                         candidate: &Candidate<'pat, 'tcx>,
-                                        variants: &mut BitVector)
+                                        variants: &mut BitVector<usize>)
                                         -> bool
     {
         let match_pair = match candidate.match_pairs.iter().find(|mp| mp.place == *test_place) {
@@ -260,9 +260,7 @@ pub fn perform_test(&mut self,
 
             TestKind::Eq { value, mut ty } => {
                 let mut val = Operand::Copy(place.clone());
-                let mut expect = self.literal_operand(test.span, ty, Literal::Value {
-                    value
-                });
+                let mut expect = self.literal_operand(test.span, ty, value);
                 // Use PartialEq::eq instead of BinOp::Eq
                 // (the binop can only handle primitives)
                 let fail = self.cfg.start_new_block();
@@ -300,9 +298,7 @@ pub fn perform_test(&mut self,
                                 let array = self.literal_operand(
                                     test.span,
                                     value.ty,
-                                    Literal::Value {
-                                        value
-                                    },
+                                    value,
                                 );
 
                                 let slice = self.temp(ty, test.span);
@@ -635,6 +631,7 @@ fn candidate_without_match_pair<'pat>(&mut self,
             bindings: candidate.bindings.clone(),
             guard: candidate.guard.clone(),
             arm_index: candidate.arm_index,
+            pat_index: candidate.pat_index,
             pre_binding_block: candidate.pre_binding_block,
             next_candidate_pre_binding_block: candidate.next_candidate_pre_binding_block,
         }
@@ -698,6 +695,7 @@ fn candidate_after_variant_switch<'pat>(&mut self,
             bindings: candidate.bindings.clone(),
             guard: candidate.guard.clone(),
             arm_index: candidate.arm_index,
+            pat_index: candidate.pat_index,
             pre_binding_block: candidate.pre_binding_block,
             next_candidate_pre_binding_block: candidate.next_candidate_pre_binding_block,
         }