impl MaybeBorrowedLocals {
/// A dataflow analysis that records whether a pointer or reference exists that may alias the
/// given local.
- pub fn new() -> Self {
+ pub fn all_borrows() -> Self {
MaybeBorrowedLocals { kind: AnyBorrow }
}
}
impl MaybeMutBorrowedLocals<'mir, 'tcx> {
/// A dataflow analysis that records whether a pointer or reference exists that may *mutably*
/// alias the given local.
- pub fn new_mut_only(
+ ///
+ /// This includes `&mut` and pointers derived from an `&mut`, as well as shared borrows of
+ /// types with interior mutability.
+ pub fn mut_borrows_only(
tcx: TyCtxt<'tcx>,
body: &'mir mir::Body<'tcx>,
param_env: ParamEnv<'tcx>,
let needs_drop = QualifCursor::new(NeedsDrop, item);
let has_mut_interior = QualifCursor::new(HasMutInterior, item);
- let indirectly_mutable = MaybeMutBorrowedLocals::new_mut_only(tcx, *body, param_env)
+ let indirectly_mutable = MaybeMutBorrowedLocals::mut_borrows_only(tcx, *body, param_env)
.into_engine(tcx, *body, def_id)
.iterate_to_fixpoint()
.into_results_cursor(*body);
// Calculate the MIR locals which have been previously
// borrowed (even if they are still active).
let borrowed_locals_results =
- MaybeBorrowedLocals::new().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
+ MaybeBorrowedLocals::all_borrows().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
let mut borrowed_locals_cursor = ResultsCursor::new(body_ref, &borrowed_locals_results);
let flow_def_inits = DefinitelyInitializedPlaces::new(tcx, body, &mdpe)
.into_engine(tcx, body, def_id)
.iterate_to_fixpoint();
- let flow_mut_borrowed = MaybeMutBorrowedLocals::new_mut_only(tcx, body, param_env)
+ let flow_mut_borrowed = MaybeMutBorrowedLocals::mut_borrows_only(tcx, body, param_env)
.into_engine(tcx, body, def_id)
.iterate_to_fixpoint();