use crate::borrow_check::AccessDepth;
use crate::dataflow::indexes::BorrowIndex;
use rustc::mir::BorrowKind;
-use rustc::mir::{BasicBlock, Body, Location, Place, PlaceBase};
-use rustc::ty::{self, TyCtxt};
+use rustc::mir::{BasicBlock, Body, Location, Place};
+use rustc::ty::TyCtxt;
use rustc_data_structures::graph::dominators::Dominators;
/// Returns `true` if the borrow represented by `kind` is
pub(super) fn each_borrow_involving_path<'tcx, F, I, S>(
s: &mut S,
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
_location: Location,
access_place: (AccessDepth, &Place<'tcx>),
if places_conflict::borrow_conflicts_with_place(
tcx,
- param_env,
body,
&borrowed.borrowed_place,
borrowed.kind,
}
/// Determines if a given borrow is borrowing local data
-/// This is called for all Yield statements on movable generators
+/// This is called for all Yield expressions on movable generators
pub(super) fn borrow_of_local_data(place: &Place<'_>) -> bool {
- match place.base {
- PlaceBase::Static(_) => false,
-
- // Reborrow of already borrowed data is ignored
- // Any errors will be caught on the initial borrow
- PlaceBase::Local(_) => !place.is_indirect(),
- }
+ // Reborrow of already borrowed data is ignored
+ // Any errors will be caught on the initial borrow
+ !place.is_indirect()
}