about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2022-05-20 15:54:22 -0400
committerGitHub <noreply@github.com>2022-05-20 15:54:22 -0400
commitbf21a81b1541a420566fc81f8a1dde5486008387 (patch)
tree7ea30c11010d1400e8e6e694cb51d03b9a78f810
parent6d6be5fd8b6615dbf8b6244d777a462efda3d410 (diff)
downloadrust-bf21a81b1541a420566fc81f8a1dde5486008387.tar.gz
rust-bf21a81b1541a420566fc81f8a1dde5486008387.zip
Update compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
-rw-r--r--compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
index 20269a67c72..8dcffd56b58 100644
--- a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
+++ b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
@@ -211,8 +211,10 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
             "fake_read place_with_id={place_with_id:?}; cause={cause:?}; diag_expr_id={diag_expr_id:?}"
         );
 
-        // fake reads happen in places like the scrutinee of a match expression, so we can treat
-        // these as a borrow.
+        // fake reads happen in places like the scrutinee of a match expression.
+        // we treat those as a borrow, much like a copy: the idea is that we are
+        // transiently creating a `&T` ref that we can read from to observe the current
+        // value (this `&T` is immediately dropped afterwards).
         self.borrow_place(place_with_id);
     }
 }