]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir_build/src/build/matches/mod.rs
Rollup merge of #100852 - Samyak2:samyak/100459, r=Mark-Simulacrum
[rust.git] / compiler / rustc_mir_build / src / build / matches / mod.rs
index ce38283724dac892e7ebd5c3200f4c417d012b52..0e5cd6199ac9fb69ec7d3ecd7e23c42c3c483669 100644 (file)
@@ -155,7 +155,7 @@ pub(crate) fn then_else_break(
     ///
     /// * From each pre-binding block to the next pre-binding block.
     /// * From each otherwise block to the next pre-binding block.
-    #[tracing::instrument(level = "debug", skip(self, arms))]
+    #[instrument(level = "debug", skip(self, arms))]
     pub(crate) fn match_expr(
         &mut self,
         destination: Place<'tcx>,
@@ -702,7 +702,7 @@ pub(crate) fn storage_live_binding(
         let local_id = self.var_local_id(var, for_guard);
         let source_info = self.source_info(span);
         self.cfg.push(block, Statement { source_info, kind: StatementKind::StorageLive(local_id) });
-        // Altough there is almost always scope for given variable in corner cases
+        // Although there is almost always scope for given variable in corner cases
         // like #92893 we might get variable with no scope.
         if let Some(region_scope) = self.region_scope_tree.var_scope(var.0.local_id) && schedule_drop{
             self.schedule_drop(span, region_scope, local_id, DropKind::Storage);
@@ -2280,15 +2280,16 @@ pub(crate) fn ast_let_else(
         mut block: BasicBlock,
         init: &Expr<'tcx>,
         initializer_span: Span,
-        else_block: &Block,
+        else_block: BlockId,
         visibility_scope: Option<SourceScope>,
         remainder_scope: region::Scope,
         remainder_span: Span,
         pattern: &Pat<'tcx>,
     ) -> BlockAnd<()> {
+        let else_block_span = self.thir[else_block].span;
         let (matching, failure) = self.in_if_then_scope(remainder_scope, |this| {
             let scrutinee = unpack!(block = this.lower_scrutinee(block, init, initializer_span));
-            let pat = Pat { ty: init.ty, span: else_block.span, kind: Box::new(PatKind::Wild) };
+            let pat = Pat { ty: init.ty, span: else_block_span, kind: Box::new(PatKind::Wild) };
             let mut wildcard = Candidate::new(scrutinee.clone(), &pat, false);
             this.declare_bindings(
                 visibility_scope,
@@ -2318,7 +2319,7 @@ pub(crate) fn ast_let_else(
             );
             // This block is for the failure case
             let failure = this.bind_pattern(
-                this.source_info(else_block.span),
+                this.source_info(else_block_span),
                 wildcard,
                 None,
                 &fake_borrow_temps,
@@ -2334,19 +2335,19 @@ pub(crate) fn ast_let_else(
         // This place is not really used because this destination place
         // should never be used to take values at the end of the failure
         // block.
-        let dummy_place = self.temp(self.tcx.types.never, else_block.span);
+        let dummy_place = self.temp(self.tcx.types.never, else_block_span);
         let failure_block;
         unpack!(
             failure_block = self.ast_block(
                 dummy_place,
                 failure,
                 else_block,
-                self.source_info(else_block.span),
+                self.source_info(else_block_span),
             )
         );
         self.cfg.terminate(
             failure_block,
-            self.source_info(else_block.span),
+            self.source_info(else_block_span),
             TerminatorKind::Unreachable,
         );
         matching.unit()