Skip to content

Commit 15a5382

Browse files
Rename MaybeBorrowedLocals constructors
1 parent 6f167e9 commit 15a5382

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/librustc_mir/dataflow/impls/borrowed_locals.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ pub struct MaybeBorrowedLocals<K = AnyBorrow> {
2727
impl MaybeBorrowedLocals {
2828
/// A dataflow analysis that records whether a pointer or reference exists that may alias the
2929
/// given local.
30-
pub fn new() -> Self {
30+
pub fn all_borrows() -> Self {
3131
MaybeBorrowedLocals { kind: AnyBorrow }
3232
}
3333
}
3434

3535
impl MaybeMutBorrowedLocals<'mir, 'tcx> {
3636
/// A dataflow analysis that records whether a pointer or reference exists that may *mutably*
3737
/// alias the given local.
38-
pub fn new_mut_only(
38+
///
39+
/// This includes `&mut` and pointers derived from an `&mut`, as well as shared borrows of
40+
/// types with interior mutability.
41+
pub fn mut_borrows_only(
3942
tcx: TyCtxt<'tcx>,
4043
body: &'mir mir::Body<'tcx>,
4144
param_env: ParamEnv<'tcx>,

src/librustc_mir/transform/check_consts/validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl Validator<'a, 'mir, 'tcx> {
141141
let needs_drop = QualifCursor::new(NeedsDrop, item);
142142
let has_mut_interior = QualifCursor::new(HasMutInterior, item);
143143

144-
let indirectly_mutable = MaybeMutBorrowedLocals::new_mut_only(tcx, *body, param_env)
144+
let indirectly_mutable = MaybeMutBorrowedLocals::mut_borrows_only(tcx, *body, param_env)
145145
.into_engine(tcx, *body, def_id)
146146
.iterate_to_fixpoint()
147147
.into_results_cursor(*body);

src/librustc_mir/transform/generator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ fn locals_live_across_suspend_points(
473473
// Calculate the MIR locals which have been previously
474474
// borrowed (even if they are still active).
475475
let borrowed_locals_results =
476-
MaybeBorrowedLocals::new().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
476+
MaybeBorrowedLocals::all_borrows().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
477477

478478
let mut borrowed_locals_cursor = ResultsCursor::new(body_ref, &borrowed_locals_results);
479479

src/librustc_mir/transform/rustc_peek.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
4545
let flow_def_inits = DefinitelyInitializedPlaces::new(tcx, body, &mdpe)
4646
.into_engine(tcx, body, def_id)
4747
.iterate_to_fixpoint();
48-
let flow_mut_borrowed = MaybeMutBorrowedLocals::new_mut_only(tcx, body, param_env)
48+
let flow_mut_borrowed = MaybeMutBorrowedLocals::mut_borrows_only(tcx, body, param_env)
4949
.into_engine(tcx, body, def_id)
5050
.iterate_to_fixpoint();
5151

0 commit comments

Comments
 (0)