Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a67b28a

Browse files
committed
Use Place directly on borrow_of_local_data, it's Copy
1 parent f026441 commit a67b28a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustc_mir/borrow_check/invalidation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
166166
let borrow_set = self.borrow_set.clone();
167167
let resume = self.location_table.start_index(resume.start_location());
168168
for i in borrow_set.borrows.indices() {
169-
if borrow_of_local_data(&borrow_set.borrows[i].borrowed_place) {
169+
if borrow_of_local_data(borrow_set.borrows[i].borrowed_place) {
170170
self.all_facts.invalidates.push((resume, i));
171171
}
172172
}
@@ -178,7 +178,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
178178
let borrow_set = self.borrow_set.clone();
179179
let start = self.location_table.start_index(location);
180180
for i in borrow_set.borrows.indices() {
181-
if borrow_of_local_data(&borrow_set.borrows[i].borrowed_place) {
181+
if borrow_of_local_data(borrow_set.borrows[i].borrowed_place) {
182182
self.all_facts.invalidates.push((start, i));
183183
}
184184
}

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14631463
fn check_for_local_borrow(&mut self, borrow: &BorrowData<'tcx>, yield_span: Span) {
14641464
debug!("check_for_local_borrow({:?})", borrow);
14651465

1466-
if borrow_of_local_data(&borrow.borrowed_place) {
1466+
if borrow_of_local_data(borrow.borrowed_place) {
14671467
let err = self.cannot_borrow_across_generator_yield(
14681468
self.retrieve_borrow_spans(borrow).var_or_use(),
14691469
yield_span,

src/librustc_mir/borrow_check/path_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub(super) fn is_active<'tcx>(
130130

131131
/// Determines if a given borrow is borrowing local data
132132
/// This is called for all Yield expressions on movable generators
133-
pub(super) fn borrow_of_local_data(place: &Place<'_>) -> bool {
133+
pub(super) fn borrow_of_local_data(place: Place<'_>) -> bool {
134134
// Reborrow of already borrowed data is ignored
135135
// Any errors will be caught on the initial borrow
136136
!place.is_indirect()

0 commit comments

Comments
 (0)