]> git.lizzy.rs Git - rust.git/commitdiff
Rename `MaybeBorrowedLocals` constructors
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Thu, 13 Feb 2020 21:56:19 +0000 (13:56 -0800)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Thu, 13 Feb 2020 22:15:09 +0000 (14:15 -0800)
src/librustc_mir/dataflow/impls/borrowed_locals.rs
src/librustc_mir/transform/check_consts/validation.rs
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/rustc_peek.rs

index 519db963d1e7dc655f58eb83ab4511d4db4e955c..20aab8b32a51d071c4cb2961f2ad3148d595a4d9 100644 (file)
@@ -27,7 +27,7 @@ pub struct MaybeBorrowedLocals<K = AnyBorrow> {
 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 }
     }
 }
@@ -35,7 +35,10 @@ pub fn new() -> Self {
 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>,
index 9fef62325f28187ce474439e7c3fadde9dd3bcd5..d9e179ad42a68ee43183125350b900ebf3ed8d83 100644 (file)
@@ -141,7 +141,7 @@ pub fn new(item: &'a Item<'mir, 'tcx>) -> Self {
         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);
index cd00274afcc00b39f22eabb5ba2c46a5b5c8f8b1..4b3cd2be66d1d6ce62c93b7ba3e5da1292250f22 100644 (file)
@@ -473,7 +473,7 @@ fn locals_live_across_suspend_points(
     // 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);
 
index 16edb7d552b24b294c30adfe7a2cd643f61ef9e2..6176cf8bc0fa6a78bab50978d57360b893724ff5 100644 (file)
@@ -45,7 +45,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, src: MirSource<'tcx>, body: &mut BodyAndCa
         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();