about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/build/matches/mod.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index 6a84658a7a9..91d439d430c 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -267,7 +267,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
 
                 // Inject a fake read of the newly created binding
                 // to test the fallout of fixing issue #53695 where NLL
-                // allows to create variables that are immediately unusable.
+                // allows creating unused variables that are effectively unusable.
                 let source_info = self.source_info(irrefutable_pat.span);
                 self.cfg.push(
                     block,
@@ -318,6 +318,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
                     },
                 );
 
+                // Inject a fake read of the newly created binding
+                // to test the fallout of fixing issue #53695 where NLL
+                // allows creating unused variables that are effectively unusable.
+                self.cfg.push(
+                    block,
+                    Statement {
+                        source_info,
+                        kind: StatementKind::ReadForMatch(place.clone()),
+                    },
+                );
+
                 self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard);
                 block.unit()
             }