]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs
Rollup merge of #93400 - ChayimFriedman2:dont-suggest-using-const-with-bounds-unused...
[rust.git] / compiler / rustc_typeck / src / check / generator_interior / drop_ranges / record_consumed_borrow.rs
index 9a308586afff3a723ef738794aac89547a8f2e52..03d3b23bb23d5cc35d4f6ab5e048bd338c401ef2 100644 (file)
@@ -93,9 +93,10 @@ fn consume(
     fn borrow(
         &mut self,
         place_with_id: &expr_use_visitor::PlaceWithHirId<'tcx>,
-        _diag_expr_id: HirId,
+        diag_expr_id: HirId,
         _bk: rustc_middle::ty::BorrowKind,
     ) {
+        debug!("borrow {:?}; diag_expr_id={:?}", place_with_id, diag_expr_id);
         self.places
             .borrowed
             .insert(TrackedValue::from_place_with_projections_allowed(place_with_id));
@@ -103,9 +104,14 @@ fn borrow(
 
     fn mutate(
         &mut self,
-        _assignee_place: &expr_use_visitor::PlaceWithHirId<'tcx>,
-        _diag_expr_id: HirId,
+        assignee_place: &expr_use_visitor::PlaceWithHirId<'tcx>,
+        diag_expr_id: HirId,
     ) {
+        debug!("mutate {:?}; diag_expr_id={:?}", assignee_place, diag_expr_id);
+        // Count mutations as a borrow.
+        self.places
+            .borrowed
+            .insert(TrackedValue::from_place_with_projections_allowed(assignee_place));
     }
 
     fn fake_read(