Use Place directly on borrow_of_local_data, it's Copy
This commit is contained in:
parent
f026441e32
commit
a67b28a96e
3 changed files with 4 additions and 4 deletions
|
@ -166,7 +166,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
|||
let borrow_set = self.borrow_set.clone();
|
||||
let resume = self.location_table.start_index(resume.start_location());
|
||||
for i in borrow_set.borrows.indices() {
|
||||
if borrow_of_local_data(&borrow_set.borrows[i].borrowed_place) {
|
||||
if borrow_of_local_data(borrow_set.borrows[i].borrowed_place) {
|
||||
self.all_facts.invalidates.push((resume, i));
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
|
|||
let borrow_set = self.borrow_set.clone();
|
||||
let start = self.location_table.start_index(location);
|
||||
for i in borrow_set.borrows.indices() {
|
||||
if borrow_of_local_data(&borrow_set.borrows[i].borrowed_place) {
|
||||
if borrow_of_local_data(borrow_set.borrows[i].borrowed_place) {
|
||||
self.all_facts.invalidates.push((start, i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1463,7 +1463,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
fn check_for_local_borrow(&mut self, borrow: &BorrowData<'tcx>, yield_span: Span) {
|
||||
debug!("check_for_local_borrow({:?})", borrow);
|
||||
|
||||
if borrow_of_local_data(&borrow.borrowed_place) {
|
||||
if borrow_of_local_data(borrow.borrowed_place) {
|
||||
let err = self.cannot_borrow_across_generator_yield(
|
||||
self.retrieve_borrow_spans(borrow).var_or_use(),
|
||||
yield_span,
|
||||
|
|
|
@ -130,7 +130,7 @@ pub(super) fn is_active<'tcx>(
|
|||
|
||||
/// Determines if a given borrow is borrowing local data
|
||||
/// This is called for all Yield expressions on movable generators
|
||||
pub(super) fn borrow_of_local_data(place: &Place<'_>) -> bool {
|
||||
pub(super) fn borrow_of_local_data(place: Place<'_>) -> bool {
|
||||
// Reborrow of already borrowed data is ignored
|
||||
// Any errors will be caught on the initial borrow
|
||||
!place.is_indirect()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue